public async Task If_profile_does_exist_then_upsert_doesnt_happen() { // arrange var username = "******"; var request = new CreateProfileIfNotExists(username); _mockBucket.Setup(m => m.ExistsAsync(username)).ReturnsAsync(true); // act await _handler.Handle(request, CancellationToken.None); // assert _mockBucket.Verify(m => m.UpsertAsync(It.IsAny <Document <TwitcherProfile> >()), Times.Never); }
public async Task If_profile_does_exist_then_upsert_doesnt_happen() { // arrange var username = "******"; var request = new CreateProfileIfNotExists(username); MockCollection.Setup(m => m.ExistsAsync(username, null)).ReturnsAsync(new FakeExistsResult(true)); // act await _handler.Handle(request, CancellationToken.None); // assert MockCollection.Verify(m => m.UpsertAsync(It.IsAny <string>(), It.IsAny <TwitcherProfile>(), null), Times.Never); }
public async Task If_profile_doesnt_exist_then_upsert_does_happen() { // arrange var username = "******"; var request = new CreateProfileIfNotExists(username); _mockBucket.Setup(m => m.ExistsAsync(username)).ReturnsAsync(false); // act await _handler.Handle(request, CancellationToken.None); // assert _mockBucket.Verify(m => m.UpsertAsync( It.Is <Document <TwitcherProfile> >(x => x.Id == username && x.Content != null))); }