示例#1
0
        public void GetDogById()
        {
            //Arrange
            IDogRepository sut  = GetInMemoryDogRepository();
            Dog            dog1 = new Dog()
            {
                Id                = 3,
                DogName           = "Jo",
                Breed             = "Terrier x",
                DOB               = DateTime.Parse("2012-07-26"),
                Image             = "jo.jpg",
                ApplicationUserId = "d4eb7d23-d641-4c2d-8cd3-a036e08a3c65"
            };

            Dog dog2 = new Dog()
            {
                Id                = 4,
                DogName           = "Maddie",
                Breed             = "Irish Terrier",
                DOB               = DateTime.Parse("2013-09-17"),
                Image             = "maddie.jpg",
                ApplicationUserId = "20f95e44-8f29-42d8-b3f9-ff4c3e683ce5"
            };

            //Act
            Dog savedDog1 = sut.CreateDog(dog1);
            Dog savedDog2 = sut.CreateDog(dog2);

            //Assert
            var foundDogById = sut.GetDogById(4);

            Assert.Equal("Maddie", foundDogById.DogName);
        }
示例#2
0
        public void Index_Update_Dog_Name()
        {
            //Arrange
            IDogRepository sut  = GetInMemoryDogRepository();
            Dog            dog1 = new Dog()
            {
                Id                = 3,
                DogName           = "Jo",
                Breed             = "Terrier x",
                DOB               = DateTime.Parse("2012-07-26"),
                Image             = "jo.jpg",
                ApplicationUserId = "d4eb7d23-d641-4c2d-8cd3-a036e08a3c65"
            };

            Dog dog2 = new Dog()
            {
                Id                = 3,
                DogName           = "Josephine",
                Breed             = "Terrier x",
                DOB               = DateTime.Parse("2012-07-26"),
                Image             = "jo.jpg",
                ApplicationUserId = "d4eb7d23-d641-4c2d-8cd3-a036e08a3c65"
            };

            //Act
            Dog savedDog  = sut.CreateDog(dog1);
            Dog savedDog1 = sut.UpdateDog(dog2);

            //Assert
            Assert.Single(sut.Dogs);
            Assert.Equal("Josephine", dog2.DogName);
        }
示例#3
0
        public void Index_Dogs()
        {
            //Arrange
            IDogRepository sut = GetInMemoryDogRepository();
            Dog            dog = new Dog()
            {
                Id                = 3,
                DogName           = "Jo",
                Breed             = "Terrier x",
                DOB               = DateTime.Parse("2012-07-26"),
                Image             = "jo.jpg",
                ApplicationUserId = "d4eb7d23-d641-4c2d-8cd3-a036e08a3c65"
            };

            //Act
            Dog savedDog = sut.CreateDog(dog);

            //Assert
            Assert.Single(sut.Dogs);
            Assert.Equal(3, savedDog.Id);
            Assert.Equal("Jo", savedDog.DogName);
            Assert.Equal("Terrier x", savedDog.Breed);
            Assert.Equal("jo.jpg", savedDog.Image);
            Assert.Equal(DateTime.Parse("2012-07-26"), savedDog.DOB);
            Assert.Equal("d4eb7d23-d641-4c2d-8cd3-a036e08a3c65", savedDog.ApplicationUserId);
        }
示例#4
0
        public void Index_DeleteDog()
        {
            //Arrange
            IDogRepository sut = GetInMemoryDogRepository();
            Dog            dog = new Dog()
            {
                Id                = 3,
                DogName           = "Jo",
                Breed             = "Terrier x",
                DOB               = DateTime.Parse("2012-07-26"),
                Image             = "jo.jpg",
                ApplicationUserId = "d4eb7d23-d641-4c2d-8cd3-a036e08a3c65"
            };

            //Act
            Dog savedDog  = sut.CreateDog(dog);
            Dog savedDog1 = sut.DeleteDog(dog);

            //Assert
            Assert.Empty(sut.Dogs);
        }