Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Unit Testing of web page loading

Unit Testing of web page loading

Scheduled Pinned Locked Moved C#
testingbeta-testinghelp
6 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sreecahitu
    wrote on last edited by
    #1

    public void abcMethod1() { string cspurl = @"http://xyz.aspx"; bool expected = true; bool actual; actual = @"http://xyz.aspx"; Assert.AreEqual(expected, actual, ""); } Here actual Value means, what could i assign for actual variable as am getting mismatch error, as i assigned string value to bool variable.

    E J L 3 Replies Last reply
    0
    • S sreecahitu

      public void abcMethod1() { string cspurl = @"http://xyz.aspx"; bool expected = true; bool actual; actual = @"http://xyz.aspx"; Assert.AreEqual(expected, actual, ""); } Here actual Value means, what could i assign for actual variable as am getting mismatch error, as i assigned string value to bool variable.

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      Why are you testing a string value to a bool? Don't you mean: Assert.IsTrue(cspurl==actual, "Check string equality");

      S 1 Reply Last reply
      0
      • E ednrgc

        Why are you testing a string value to a bool? Don't you mean: Assert.IsTrue(cspurl==actual, "Check string equality");

        S Offline
        S Offline
        sreecahitu
        wrote on last edited by
        #3

        even then am getting an error, "Operator '==' cannot be applied to operands of type 'bool' and 'string'", if i use the Assert.IsTrue(cspurl==actual,"Check string equality");

        E 1 Reply Last reply
        0
        • S sreecahitu

          even then am getting an error, "Operator '==' cannot be applied to operands of type 'bool' and 'string'", if i use the Assert.IsTrue(cspurl==actual,"Check string equality");

          E Offline
          E Offline
          ednrgc
          wrote on last edited by
          #4

          you declared actual as a bool. Declare it as a string.

          1 Reply Last reply
          0
          • S sreecahitu

            public void abcMethod1() { string cspurl = @"http://xyz.aspx"; bool expected = true; bool actual; actual = @"http://xyz.aspx"; Assert.AreEqual(expected, actual, ""); } Here actual Value means, what could i assign for actual variable as am getting mismatch error, as i assigned string value to bool variable.

            J Offline
            J Offline
            Judah Gabriel Himango
            wrote on last edited by
            #5

            public void abcMethod1()
            {
            string expected = @"http://xyz.aspx";
            string actual = ...; // get the actual value here
            Assert.AreSame(expected, actual);
            }

            Tech, life, family, faith: Give me a visit. I'm currently blogging about: Check out this cutie The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

            1 Reply Last reply
            0
            • S sreecahitu

              public void abcMethod1() { string cspurl = @"http://xyz.aspx"; bool expected = true; bool actual; actual = @"http://xyz.aspx"; Assert.AreEqual(expected, actual, ""); } Here actual Value means, what could i assign for actual variable as am getting mismatch error, as i assigned string value to bool variable.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I probably don't understand this, but from when we can assign string values to bool (which is always true or false) data value type ?! If you need compare two strings (use string's .Equals function) : string ww1 = @"http://xyz.aspx"; string ww2 = @"http://xyz.aspx"; if (ww1.Equals(ww2)) { // oh yes :) }

              VirtualVoid**.NET**

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups