Ejemplo n.º 1
0
 public void TestCatsCollectionSignalsWhenCatIsAdded()
 {
     CatOwner anOwner = new CatOwner("Drake");
     Mock<ICat> mockCat = new Mock<ICat>();
     bool fired = false;
     NotifyCollectionChangedEventHandler handler = (a, b) => { fired = true; };
     anOwner.CatsNotifyCollectionChanged.CollectionChanged += handler;
     anOwner.AddCat(mockCat.Object);
     Assert.IsTrue(fired);
 }
Ejemplo n.º 2
0
 public void TestCatOwnerMapping()
 {
     ICatOwner aCatOwner = new CatOwner("Bill");
     Mock<ICat> mockCat = new Mock<ICat>();
     aCatOwner.AddCat(mockCat.Object);
     AutoMapperDTOMapper mapper = new AutoMapperDTOMapper();
     CatOwnerDataContract dto = mapper.Map<ICatOwner, CatOwnerDataContract>(aCatOwner);
     Assert.AreEqual(aCatOwner.Name, dto.Name);
     Assert.AreEqual(mockCat.Object, dto.Cats[0]);
     ICatOwner aCatOwner2 = mapper.Map<CatOwnerDataContract, ICatOwner>(dto);
     Assert.AreEqual(aCatOwner, aCatOwner2);
 }
Ejemplo n.º 3
0
 public void TestTwoOwnersWithTheSameNameAreEqual()
 {
     CatOwner anOwnerNamedBill = new CatOwner("Bill");
     CatOwner anotherOwnerNamedBill = new CatOwner("Bill");
     Assert.AreEqual(anOwnerNamedBill, anotherOwnerNamedBill);
 }
Ejemplo n.º 4
0
 public void TestCatOwnerCreationWithoutCats()
 {
     CatOwner anOwnerWithoutCats  = new CatOwner("Bill");
     Assert.AreEqual("Bill",anOwnerWithoutCats.Name);
     Assert.AreEqual(0, anOwnerWithoutCats.CatsReadonly.Count);
 }