Exemple #1
0
        public async void GetReturnValidResponseIfPartnerNotFoundTest()
        {
            var controller = new PartnerController(partnerService, mapper, appSettings);
            var response   = await controller.Get(-1);

            var notFoundResult = response as NotFoundObjectResult;

            Assert.NotNull(notFoundResult);
            Assert.Equal(404, notFoundResult.StatusCode);
        }
        public async Task Get()
        {
            var expectedId = 123;
            var response   = new PartnerDetailsDto();

            _mockMediator.Setup(x => x.Send(It.Is <GetPartnerDetailsQuery>(q => q.Id == expectedId), It.IsAny <CancellationToken>()))
            .ReturnsAsync(response);

            var result = await _sut.Get(expectedId);

            Assert.IsAssignableFrom <OkObjectResult>(result.Result);
            Assert.AreEqual(response, ((OkObjectResult)result.Result).Value);
        }
Exemple #3
0
        public async void GetSinglePartnerTest()
        {
            var controller = new PartnerController(partnerService, mapper, appSettings);
            var response   = await controller.Get(1);

            var okResult = response as OkObjectResult;

            Assert.NotNull(okResult);
            Assert.Equal(200, okResult.StatusCode);
            Assert.NotNull(okResult.Value);

            var partner = okResult.Value as Partner;

            Assert.Equal(1, partner.Id);
        }