public async Task CreateAsync_Success() { var entity = new MongoTestEntity() { Bool = false, Number = 1, String = "String" }; entity = await Repository.CreateAsync(entity); Assert.IsNotNull(entity.Id); Assert.IsTrue(entity.Created >= DateTime.UtcNow.AddSeconds(-5)); Assert.IsTrue(entity.Updated >= DateTime.UtcNow.AddSeconds(-5)); }
public async Task CreateAsyncByItemShouldSucceed() { await _mockObjectRepo.CreateAsync(_mockObject); await _mockDocumentRepo.CreateAsync(_mockDocument98); var item = await _mockDocumentRepo.FindAsync(_mockDocument98.Id); Assert.Equal(_mockDocument98.Id, item.Id); Assert.Equal(_mockDocument98.Name, item.Name); Assert.Equal(_mockDocument98.Value, item.Value); Assert.True(_mockDocument98.CreationDate.EqualsMongoDateTime(item.CreationDate)); Assert.Equal(_mockDocument98.IsActive, item.IsActive); }