コード例 #1
0
        public void CanRetrieveAllPets()
        {
            //Arrange
            var mockPetAccessor = new PetAccessorMock();
            var petManager      = new PetManager(mockPetAccessor);
            //Act
            var result = petManager.RetrieveAllPets();

            //Assert
            Assert.AreEqual(4, result.Count);
            petManager.CreatePet(new Pet());
            petManager.CreatePet(new Pet());
            result = petManager.RetrieveAllPets();
            Assert.AreEqual(6, result.Count);
        }
コード例 #2
0
        public void CreatePetReturnsFalseForNull()
        {
            //Arrange
            var mockPetAccessor = new PetAccessorMock();
            var petManager      = new PetManager(mockPetAccessor);
            //Act
            var result = petManager.CreatePet(null);

            //Assert
            Assert.AreEqual(0, result); // edited on 3/17/19 by Matt H.
        }
コード例 #3
0
        public void CanCreatePet()
        {
            //Arrange
            var mockPetAccessor = new PetAccessorMock();
            var petManager      = new PetManager(mockPetAccessor);
            var newPet          = new Pet();
            //Act
            var result = petManager.CreatePet(newPet);

            //Assert
            Assert.AreEqual(1, result); // edited on 3/17/119 by Matt H.
        }
コード例 #4
0
        public void CanCreatePetImage()
        {
            //Arrange
            var mockPetAccessor = new PetAccessorMock();
            var petManager      = new PetManager(mockPetAccessor);
            Pet newPet          = new Pet();

            newPet.PetID         = 100099;
            newPet.imageFilename = "pet999.jpg";
            //Act
            petManager.CreatePet(newPet);
            var result = petManager.AddPetImageFilename(newPet.imageFilename, newPet.PetID);

            //Assert
            Assert.IsTrue(result);
        }