public async Task PopulatedDataShouldReturnCorrectData(string memory, string storage, string minimumCpu, string resolution) { Expression <Func <INativeDesktopMemoryAndStorage, bool> > nativeDesktopMemoryAndStorage = d => d.MinimumMemoryRequirement == memory && d.StorageRequirementsDescription == storage && d.MinimumCpu == minimumCpu && d.RecommendedResolution == resolution; Expression <Func <IClientApplication, bool> > clientApplication = c => c.NativeDesktopMemoryAndStorage == Mock.Of(nativeDesktopMemoryAndStorage); mediatorMock .Setup(m => m.Send( It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>())) .ReturnsAsync(Mock.Of(clientApplication)); var result = await controller.Get(SolutionId) as ObjectResult; Assert.NotNull(result); result.StatusCode.Should().Be(StatusCodes.Status200OK); result.Value.Should().BeOfType <GetNativeDesktopMemoryAndStorageResult>(); var memoryAndStorageResult = result.Value as GetNativeDesktopMemoryAndStorageResult; Assert.NotNull(memoryAndStorageResult); memoryAndStorageResult.MinimumMemoryRequirement.Should().Be(memory); memoryAndStorageResult.StorageRequirementsDescription.Should().Be(storage); memoryAndStorageResult.MinimumCpu.Should().Be(minimumCpu); memoryAndStorageResult.RecommendedResolution.Should().Be(resolution); }
public async Task PopulatedDataShouldReturnCorrectData(string memory, string storage, string minimumCpu, string resolution) { _mediatorMock.Setup(x => x.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == _solutionId), It.IsAny <CancellationToken>())) .ReturnsAsync(Mock.Of <IClientApplication>(c => c.NativeDesktopMemoryAndStorage == Mock.Of <INativeDesktopMemoryAndStorage>(t => t.MinimumMemoryRequirement == memory && t.StorageRequirementsDescription == storage && t.MinimumCpu == minimumCpu && t.RecommendedResolution == resolution))); var result = await _controller.Get(_solutionId).ConfigureAwait(false) as ObjectResult; result.Should().NotBeNull(); result.StatusCode.Should().Be((int)HttpStatusCode.OK); result.Value.Should().BeOfType <GetNativeDesktopMemoryAndStorageResult>(); var memoryAndStorageResult = result.Value as GetNativeDesktopMemoryAndStorageResult; memoryAndStorageResult.MinimumMemoryRequirement.Should().Be(memory); memoryAndStorageResult.StorageRequirementsDescription.Should().Be(storage); memoryAndStorageResult.MinimumCpu.Should().Be(minimumCpu); memoryAndStorageResult.RecommendedResolution.Should().Be(resolution); }