Example #1
0
        public async void SavesChangesOnTryAddChat()
        {
            var chat       = ChatBuilder.Any();
            var repository = CreateRepository();

            await repository.TryAddChatAndSaveAsync(chat);

            _appDbContextMock.Verify(context => context.SaveChanges(), Times.Once);
        }
Example #2
0
        public async void TriesAddChatToRepository()
        {
            var chat       = ChatBuilder.Any();
            var repository = CreateRepository();

            var result = await repository.TryAddChatAndSaveAsync(chat);

            result.Should().BeTrue();
        }
Example #3
0
        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();
        }