???????????????????NUnit?????£?????????????????????д???????PPT????????????????????????????????????????н????

????1??Assert??

????2??NUnit?Attribue???

????3??NUnit???

????????1??2???????????????NUnit???????????ο??????????NUnit???????????????????????????

????NUnit?Assertion???

????NUnit??.Net???????????????.Net?????????????????С?

?????κ?xUnit?????????????????????ж??NUnit??????????????????xUnit????Junit??phpUnit??pythonUnit??????????????????Generic??Attribute????????????NUnit?????????楨????????????????????????????

????Nunit????????????????????Assert??StringAssert??FileAssert??DirectoryAssert?????????NUnit.Framework???????????Assert?????????????????????????????????????????壬????????????????????????????????????????????Assert???????????????????ж??????????????????ú???????????????????????????????????????????????

???????Assert??

??????????????????????????Assert???е??????????????????д????????????Assert. AreEqual()???????????????AreEqual??NUnit?????????????????????????????

????1?????/??????ж?

????AreEqual???ж?????????

????AreNotEqual???ж???????????

?????????

    Int a=1 
    Assert.AreEqual(a??1);//????ж? 
    Assert.AreEqual(a??2);//????????ж?

???????????AreEqual/ AreNotEqual?????漸?????е?????????????????????????????????????????????????Assert .AreEqual(int a??int b)?????????????????????

??Assert.AreEqual(inta??intb??stringmessage);

?????? Assert.XXX(inta??intb??stringmessage);

???????е?????????????????????????????????????????λ

????????double??decimal???????????????????????????????

???????????′???

    doublea = 1.1; 
    doubleb = 1.11; 
    doublec = 0.1; 
    Assert.AreEqual(a?? b?? c);//????ж? 
    c=0.01; 
    Assert.AreEqual(a?? b?? c);//????????ж?

????2??????ж?

????AreSame???ж????????????

????AreNotSame???ж????????????

????Contains???ж????????????

?????????

    Listlist = newList(); 
    list.Add("a"); 
    list.Add("b"); 
    Assert.Contains("a"?? list); //????ж? 
    Assert.Contains("aa"?? list); //????????ж?

????3???????ж?

????IsTrue???ж????????

????True?????

????IsFalse???ж????????

????False?????

????IsNull???ж???????

????Null?????

????IsNotNull???ж??????

????NotNull?????

????IsNaN???ж??????Nan

????IsEmpty/IsNotEmpty???ж????????????/?????

????IsEmpty/IsNotEmpty???ж??????????/?????

?????????

??inta=100;

??Assert. IsTrue(a==100);//????ж?

??Assert. True(a==100);//????ж?

????4??????ж?

????Greater??????

????GreaterOrEqual?????????

????Less??С??

????LessOrEqual??С?????

?????????

    inta = 100; 
    Assert.Greater(a?? 99); 
    Assert.GreaterOrEqual(a?? 100);