Exemplo n.º 1
0
        public async Task CharacterUseCaseTest_GetListAsync_BN002()
        {
            // Arrange
            var characterInput = CharacterInputFaker.Create().Generate();

            characterInput.Limit = 0;

            // Act
            var exception = await Assert.ThrowsAsync <BusinessException>(async() => await _characterUseCase.GetListAsync(characterInput));

            //Assert
            Assert.Contains(ExceptionMessages.BN002, exception.Message);
        }
Exemplo n.º 2
0
        public async Task CharacterUseCaseTest_GetByIdAsync_Success()
        {
            // Arrange
            var characterInput       = CharacterInputFaker.Create().Generate();
            var characterDataWrapper = CharacterDataWrapperFaker.Create().Generate();

            // Setup
            _characterRepository
            .Setup(p => p.GetCharacter(characterInput))
            .Returns(Task.FromResult(characterDataWrapper));

            // Act
            var result = await _characterUseCase.GetByIdAsync(characterInput);

            //Assert
            Assert.True(result.Data.Results.Any());
        }
Exemplo n.º 3
0
        public async Task CharacterUseCaseTest_GetByIdAsync_NotFound()
        {
            // Arrange
            var characterInput       = CharacterInputFaker.Create().Generate();
            var characterDataWrapper = CharacterDataWrapperFaker.Create().Generate();

            characterDataWrapper.Data.Results.Clear();
            characterDataWrapper.Data.Count = 0;

            // Setup
            _characterRepository
            .Setup(p => p.GetCharacter(characterInput))
            .Returns(Task.FromResult(characterDataWrapper));

            // Act
            var exception = await Assert.ThrowsAsync <NotFoundException>(async() => await _characterUseCase.GetByIdAsync(characterInput));

            //Assert
            Assert.Contains(ExceptionMessages.BN008, exception.Message);
        }