internal DogSearchResultsListBuilder ListOf14Beagels()
        {
            var category = new Category() { Description = "Dogs for hunting foxes and badgers etc.", Id = 3, Name = "Hunting" };
            var beagle = new Breed() { Name = "Beagel", Category = category, Id = 3, Species = null };

            var beagleHuntingDog = new Dog() { Name = "Shep", Breed = beagle };
            var fourteenMatchedDogs = new ObservableCollection<Dog>()
            {   beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
                ,beagleHuntingDog
            };
            _dogs.AddRange(fourteenMatchedDogs);
            return this;
        }
        internal DogSearchResultsListBuilder ListOf3DalmatiansByCategory(int categoryId, int breedId)
        {
            var category = new Category() { Description = "Dogs for hunting foxes and badgers etc.", Id = categoryId, Name = "Hunting" };
            var dalmatian = new Breed() { Name = "Dalmatian", Category = category, Id = breedId, Species = null };

            var dalmatianDog1 = new Dog() { Name = "Tip", Breed = dalmatian, BreedId = breedId};
            var dalmatianDog2 = new Dog() { Name = "Snoop", Breed = dalmatian, BreedId = breedId };
            var dalmatianDog3 = new Dog() { Name = "Ron", Breed = dalmatian, BreedId = breedId };

            var matchedDogs = new ObservableCollection<Dog>()
            {   dalmatianDog1
                ,dalmatianDog2
                ,dalmatianDog3
            };
            _dogs.AddRange(matchedDogs);
            return this;
        }
        internal DogSearchResultsListBuilder ListOf3BeagelsByCategory(int categoryId, int breedId)
        {
            var category = new Category() { Description = "Dogs for hunting foxes and badgers etc.", Id = categoryId, Name = "Hunting" };
            var beagle = new Breed() { Name = "Beagel", Category = category, Id = breedId, Species = null };

            var beagleHuntingDog1 = new Dog() { Name = "Shep", Breed = beagle };
            var beagleHuntingDog2 = new Dog() { Name = "Flo", Breed = beagle };
            var beagleHuntingDog3 = new Dog() { Name = "Rex", Breed = beagle };

            var matchedDogs = new ObservableCollection<Dog>()
            {   beagleHuntingDog1
                ,beagleHuntingDog2
                ,beagleHuntingDog3
            };
            _dogs.AddRange(matchedDogs);
            return this;
        }
        public void GetById_ExecutesTheQuery()
        {
            var dogSpecies = new Species { Id = 1, Name = "Dog" };
            var yorkieTerrier = new Breed { Id = 1, Name = "Yorkshire Terrier", Species = dogSpecies };

            using (var uow = new UnitsOfWork.UnitOfWork<FakeAnimalsDbContext>(_fakeDbContext))
            {
                using (var repo = new BreedsRepository(uow))
                {
                    //act
                    repo.Add(yorkieTerrier);

                    //assert
                    Assert.That(repo.GetById(1), Is.EqualTo(yorkieTerrier));
                }
            }
        }
        public void Add_AddsObjectT()
        {
            var dogSpecies = new Species { Id = 1, Name = "Dog" };
            var dalmatian = new Breed { Id = 1, Name = "Dalmatian", Species = dogSpecies };

            using (var uow = new UnitsOfWork.UnitOfWork<FakeAnimalsDbContext>(_fakeDbContext))
            {
                using (var repo = new BreedsRepository(uow))
                {
                    //act
                    repo.Add(dalmatian);

                    //assert
                    Assert.That(repo.GetById(1), Is.EqualTo(dalmatian));
                }
            }
        }
        public void GetById_ExecutesTheQuery()
        {
            var dogSpecies = new Species { Id=1, Name = "Dog" };
            var dalmatian = new Breed { Id=1, Name = "Dalmatian", Species = dogSpecies };
            var testDog = new Dog { Id = 1, AgeInYears = 4, Headline = "A well behaved dalmatian.", Name = "Jessie", IsLitter = false, IsSold = false, Breed = dalmatian };

            using (var uow = new UnitsOfWork.UnitOfWork<FakeAnimalsDbContext>(_fakeDbContext))
            {
                using (var repo = new DogsRepository(uow))
                {
                   //act
                    repo.Add(testDog);

                    //assert
                    Assert.That(repo.GetById(1), Is.EqualTo(testDog));
                }
            }
        }
        public void Delete_DeletesObjectT()
        {
            var dogSpecies = new Species { Id = 1, Name = "Dog" };
            var dalmatian = new Breed { Id = 1, Name = "Dalmatian", Species = dogSpecies };

            using (var uow = new UnitsOfWork.UnitOfWork<FakeAnimalsDbContext>(_fakeDbContext))
            {
                using (var repo = new BreedsRepository(uow))
                {
                    repo.Add(dalmatian);

                    //act
                    repo.Delete(1);

                    //assert
                    Assert.That(repo.Context.Entry(dalmatian).State.ToString() == "Deleted");
                }
            }
        }
        public void Delete_DeletesObjectT()
        {
            var dogSpecies = new Species { Id = 1, Name = "Dog" };
            var dalmatian = new Breed { Id = 1, Name = "Dalmatian", Species = dogSpecies };
            var testDog = new Dog() { Id = 1, AgeInYears = 4, Headline = "A well behaved dalmatian.",
                Name = "Jessie", IsLitter = false, IsSold = false,
                CreatedOn = DateTime.Today.Date,
                ModifiedOn = DateTime.Today.Date,
                Breed = dalmatian };

            using (var uow = new UnitsOfWork.UnitOfWork<FakeAnimalsDbContext>(_fakeDbContext))
            {
                using (var repo = new DogsRepository(uow))
                {
                    repo.Add(testDog);

                    //act
                    repo.Delete(1);

                    //assert
                    Assert.That(repo.Context.Entry(testDog).State.ToString() == "Deleted");
                }
            }
        }