public async Task ShouldGetNativeDesktopAdditionalInformation(string information)
        {
            _mockMediator
            .Setup(m => m.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()))
            .ReturnsAsync(Mock.Of <IClientApplication>(c => c.NativeDesktopAdditionalInformation == information));

            var response = (await _nativeDesktopAdditionalInformationController.GetAsync(SolutionId)
                            .ConfigureAwait(false)) as ObjectResult;

            response.StatusCode.Should().Be((int)HttpStatusCode.OK);

            var result = response.Value as GetNativeDesktopAdditionalInformationResult;

            result.NativeDesktopAdditionalInformation.Should().Be(information);
            _mockMediator.Verify(
                m => m.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()),
                Times.Once);
        }
예제 #2
0
        public async Task ShouldGetNativeDesktopAdditionalInformation(string information)
        {
            mockMediator
            .Setup(m => m.Send(
                       It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(Mock.Of <IClientApplication>(c => c.NativeDesktopAdditionalInformation == information));

            var response = await nativeDesktopAdditionalInformationController.GetAsync(SolutionId) as ObjectResult;

            Assert.NotNull(response);
            response.StatusCode.Should().Be(StatusCodes.Status200OK);

            var result = response.Value as GetNativeDesktopAdditionalInformationResult;

            Assert.NotNull(result);
            result.NativeDesktopAdditionalInformation.Should().Be(information);

            mockMediator.Verify(m => m.Send(
                                    It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId),
                                    It.IsAny <CancellationToken>()));
        }