Esempio n. 1
0
            public void TestFindByName()
            {
                //Arrange
                string findName = "fido";
                int    findWeight = 20;
                Dog    foundByName, foundByWeight;

                MammalRepo repo = new MammalRepo();

                repo.Add(new Dog()
                {
                    Name = findName, Weight = 10
                });
                repo.Add(new Dog()
                {
                    Name = "milo", Weight = findWeight
                });
                //act
                foundByName   = repo.GetMammalByName(findName) as Dog;
                foundByWeight = repo.GetMammalByWeight(findWeight) as Dog;

                //assert
                Assert.AreEqual(findName, foundByName.Name);
                Assert.AreEqual(findWeight, foundByWeight.Weight);
            }
Esempio n. 2
0
            public void TestFindByNameReturnsNullIfNotFound()
            {
                //Arrange
                string findName   = "jeff";
                int    findWeight = 20;
                Dog    foundByName;

                MammalRepo repo = new MammalRepo();

                repo.Add(new Dog()
                {
                    Name = "fido", Weight = 10
                });
                repo.Add(new Dog()
                {
                    Name = "milo", Weight = findWeight
                });
                //act
                foundByName = repo.GetMammalByName(findName) as Dog;


                //assert
                Assert.IsNull(foundByName);
            }