Пример #1
0
        public async Task ShouldGetNativeDesktopOperatingSystemsDescription()
        {
            var description = "A description full of detail.";

            _mockMediator
            .Setup(m => m.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()))
            .ReturnsAsync(Mock.Of <IClientApplication>(c => c.NativeDesktopOperatingSystemsDescription == description));

            var response = (await _desktopOperatingSystemsController.GetSupportedOperatingSystems(SolutionId)
                            .ConfigureAwait(false)) as ObjectResult;

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

            var result = response.Value as GetNativeDesktopOperatingSystemsResult;

            result.OperatingSystemsDescription.Should().Be(description);
            _mockMediator.Verify(
                m => m.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()),
                Times.Once);
        }
        public async Task ShouldGetNativeDesktopOperatingSystemsDescription()
        {
            const string description = "A description full of detail.";

            mockMediator
            .Setup(m => m.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()))
            .ReturnsAsync(Mock.Of <IClientApplication>(c => c.NativeDesktopOperatingSystemsDescription == description));

            var response = await desktopOperatingSystemsController.GetSupportedOperatingSystems(SolutionId) as ObjectResult;

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

            var result = response.Value as GetNativeDesktopOperatingSystemsResult;

            Assert.NotNull(result);
            result.OperatingSystemsDescription.Should().Be(description);

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