public void GetById_NoEntries_ReturnsNull() { using (var connection = new DbConnection()) { var dbContextBuilder = new StubDbContextBuilder(connection.DbOptions); using (var context = dbContextBuilder.Build()) { var sut = new StubCrudRepository(context); sut.GetById(42).Should().BeNull(); } } }
public void GetById_GetsElementAsExpected() { using (var connection = new DbConnection()) { var dbContextBuilder = new StubDbContextBuilder(connection.DbOptions) .With(new StubDbModel { Id = 42 }); using (var context = dbContextBuilder.Build()) { var sut = new StubCrudRepository(context); sut.GetById(42).Should().NotBeNull(); } } }