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

            await repository.TryAddChatAndSaveAsync(chat);

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

            var result = await repository.TryAddChatAndSaveAsync(chat);

            result.Should().BeTrue();
        }
Esempio n. 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();
        }