Esempio n. 1
0
        public void SendAnimalToShelter_ReturnsZeroAnimals()
        {
            //Arrange
            var shelterLogicBuilder = new ShelterLogicBuilder();
            var shelterLogic        = shelterLogicBuilder.Build();
            var cat = new Cat {
                Name = "cat1", AgeInHumanYears = 3, Price = 13.20
            };
            var person = new Person
            {
                Name         = "John",
                Age          = 18,
                Money        = 29.99,
                OwnedAnimals = new Dictionary <string, Animal>()
                {
                    { cat.Name, cat }
                }
            };

            var expected = 0;

            //Act
            person.SendAnimalToShelter(shelterLogic, cat);
            var actual = person.OwnedAnimals.Count;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void SendAnimalToShelter_ZeroAnimals_ThrowsException()
        {
            //Arrange
            var shelterLogicBuilder = new ShelterLogicBuilder();
            var shelterLogic        = shelterLogicBuilder.Build();
            var animal = new Animal();
            var person = new Person
            {
                Name         = "John",
                Age          = 18,
                Money        = 29.99,
                OwnedAnimals = new Dictionary <string, Animal>()
            };

            shelterLogic.SendAnimalToShelter(animal, person);
        }
Esempio n. 3
0
        public void SendAnimalToShelter_InvalidAnimal_ThrowsException()
        {
            //Arrange
            var shelterLogicBuilder = new ShelterLogicBuilder();
            var shelterLogic        = shelterLogicBuilder.Build();
            var cat = new Animal {
                Name = "cat1", AgeInHumanYears = 3, Price = 13.20
            };
            var person = new Person
            {
                Name         = "John",
                Age          = 18,
                Money        = 29.99,
                OwnedAnimals = new Dictionary <string, Animal>()
                {
                    { cat.Name, cat }
                }
            };

            //Act

            shelterLogic.SendAnimalToShelter(cat, person);
            //Assert
        }