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)); } } }