public async Task GivenId_AndEntity_AndCancellationToken_WhenUpdate_ThenCollectionReplaceOneAsync() { // Arrange var sut = new TestableMongoDbDataStorageService( _mockMongoClient.Object, _configuration); var entity = new TestableStorageEntity(); var id = ObjectId.GenerateNewId().ToString(); var cancellationTokenSource = new CancellationTokenSource(); // Act await sut.Update( id, entity, cancellationTokenSource.Token); // Assert _mockCollection.Verify(x => x.ReplaceOneAsync( It.IsAny <FilterDefinition <TestableStorageEntity> >(), // TODO: This needs asserting It.Is <TestableStorageEntity>(y => y == entity), It.Is <ReplaceOptions>(y => y == null), It.Is <CancellationToken>(y => y == cancellationTokenSource.Token)), Times.Once); }