public async void SavesChangesOnTryAddChat() { var chat = ChatBuilder.Any(); var repository = CreateRepository(); await repository.TryAddChatAndSaveAsync(chat); _appDbContextMock.Verify(context => context.SaveChanges(), Times.Once); }
public async void TriesAddChatToRepository() { var chat = ChatBuilder.Any(); var repository = CreateRepository(); var result = await repository.TryAddChatAndSaveAsync(chat); result.Should().BeTrue(); }
public async void ReturnsFalseWhenExceptionHappenedOnTryAddChatAndSaveAsync() { _appDbContextMock.Setup(context => context.SaveChanges()) .Throws <Exception>(); var chat = ChatBuilder.Any(); var repository = CreateRepository(); var result = await repository.TryAddChatAndSaveAsync(chat); result.Should().BeFalse(); }