public async Task Add_Entity_IncreaseCountByOne() { var repository = new TestRepository(TestContext); var entityStub = new TestEntity("Example"); await repository.AddAsync(entityStub); var entitiesAmount = repository.Count(); entitiesAmount.Should().Be(1); }
public async Task Update_Entity_ChangeInformation() { var repository = new TestRepository(TestContext); var entityStub = new TestEntity("Example"); await repository.AddAsync(entityStub); entityStub.Name = "123"; await repository.UpdateAsync(entityStub); var expectedEntity = await repository.FirstOrDefaultAsync(c => c.Id == entityStub.Id); expectedEntity.Should().BeEquivalentTo(entityStub); }
public async void InsertNewRecord_FollowedByFind_OnSecondary_Returns_Object() { var id = Guid.NewGuid().ToString(); // Arrange var document = await repositoryReadWrite.AddAsync(new TestClass() { Id = id, Name = "Test123" }); // Act await Task.Delay(1000); var queryRead = (await repositoryRead.WhereAsync(x => x.Id == id)).ToList().FirstOrDefault(); //Assert Assert.True(queryRead.Id == id); }
public async Task FindTest() { var foo = new Foo(); var foo2 = new Foo(); var foo3 = new Foo(); await _testRepository.AddAsync(foo); await _testRepository.AddAsync(foo2); await _testRepository.AddAsync(foo3); var result = await _testRepository.FindAsync(i => i.Id.Equals(foo2.Id) || i.Id.Equals(foo3.Id)); CollectionAssert.AreEquivalent(new List <Foo> { foo2, foo3 }, result.ToList()); }