Exemplo n.º 1
0
        public void GetTaxonomyControllerActionCallsTheTaxonomyUseCase()
        {
            var requestParam = Randomm.Create <int>();

            _classUnderTest.GetTaxonomy(requestParam);
            _mockUseCase.Verify(uc => uc.ExecuteGetById(It.Is <int>(p => p == requestParam)), Times.Once);
        }
Exemplo n.º 2
0
        public void WhenSearchedTaxonomyIsFoundSuccessfullyThenGetTaxonomyControllerReturns200OkResponse()
        {
            // arrange
            var expectedStatusCode = 200;
            var expectedRespType   = typeof(OkObjectResult);

            var id = Randomm.Id();

            _mockUseCase.Setup(u => u.ExecuteGet(It.Is <int>(p => p == id))).Returns(new TaxonomyResponse());

            // act
            var controllerResponse = _classUnderTest.GetTaxonomy(id);

            // assert
            var responseObjectResult = controllerResponse as ObjectResult;

            responseObjectResult.Should().NotBeNull();
            responseObjectResult.Should().BeOfType(expectedRespType);

            var responseStatusCode = responseObjectResult.StatusCode;

            responseStatusCode.Should().Be(expectedStatusCode);
        }