public async Task Get_IdZero_ReturnsError()
        {
            var mockMakerService = new Mock <IMakerService>();
            var makerController  = new MakerController(mockMakerService.Object);

            var response = await makerController.Get(0).ConfigureAwait(false);

            response.Result.Should().BeOfType <BadRequestResult>();
        }
        public async Task Get_NoCondition_Calls_MakersService_GetAll()
        {
            var mockMakerService = new Mock <IMakerService>();
            var makerController  = new MakerController(mockMakerService.Object);

            var response = await makerController.Get().ConfigureAwait(false);

            mockMakerService.Verify(x => x.GetAll());
            response.Result.Should().BeOfType <OkObjectResult>();
        }
        public async Task Get_NoCondition_Calls_MakersService_GetAll_ThrowsException_ReturnsInternalServerError()
        {
            var mockMakerService = new Mock <IMakerService>();

            mockMakerService.Setup(x => x.GetAll()).Returns(() => throw new Exception());

            var makerController = new MakerController(mockMakerService.Object);

            var response = await makerController.Get().ConfigureAwait(false);

            response.Result.Should().BeOfType <StatusCodeResult>()
            .Which.StatusCode.Should().Be((int)HttpStatusCode.InternalServerError);
        }
        public async Task Get_IdNotFound_ReturnsNotFound()
        {
            var mockMakerService = new Mock <IMakerService>();

            mockMakerService.Setup(x => x.Get(It.IsAny <int>())).ReturnsAsync(() => null);

            var makerController = new MakerController(mockMakerService.Object);

            var response = await makerController.Get(1).ConfigureAwait(false);

            mockMakerService.Verify(x => x.Get(It.IsAny <int>()));

            response.Result.Should().BeOfType <NotFoundResult>();
        }
        public async Task Get_IdFound_Calls_MakersService_Get_ReturnsMatchingMaker()
        {
            var expectedMakerId = 111;
            var expectedMaker   = new Maker {
                Id = expectedMakerId, Name = "maker Name"
            };
            var mockMakerService = new Mock <IMakerService>();

            mockMakerService.Setup(x => x.Get(expectedMakerId)).ReturnsAsync(() => expectedMaker);

            var makerController = new MakerController(mockMakerService.Object);

            var response = await makerController.Get(expectedMakerId).ConfigureAwait(false);

            mockMakerService.Verify(x => x.Get(expectedMakerId));

            response.Result.Should().BeOfType <OkObjectResult>()
            .Which.Value.Should().BeOfType <Maker>()
            .Which.Id.Should().Be(expectedMakerId);
        }