Exemplo n.º 1
0
        public void CreateExecuteRequest_ValidInputAndOutputViewModelsGiven_ShouldCreateRequest()
        {
            const string processName = "processName";

            var inputs = new List <DataInputViewModel>
            {
                new LiteralInputViewModel {
                    Value = "a"
                },
                new BoundingBoxInputViewModel(new MapServiceMock(), new ContextMock(), new DialogServiceMock())
                {
                    RectangleViewModel = new RectangleViewModel(new Tuple <double, double>(0.0, 0.0), new Tuple <double, double>(0.0, 0.0))
                },
                new DataInputViewModel(), // Dummy input, should be removed by the factory
                new ComplexDataViewModel(new DialogServiceMock())
                {
                    Input = "i"
                },
                new DataInputViewModel {
                    IsReference = true, ReferenceUrl = "ref uri"
                },
            };

            var selectedFormat = new FormatViewModel
            {
                MimeType         = "test format",
                SelectedEncoding = "encoding",
                SelectedSchema   = "schema"
            };
            var outputs = new List <DataOutputViewModel>
            {
                new LiteralDataOutputViewModel {
                    SelectedFormat = selectedFormat, IsIncluded = true
                },
                new DataOutputViewModel(), // Dummy output, should be removed by the factory
            };

            var request = _requestFactory.CreateExecuteRequest(processName, inputs, outputs);

            request.Identifier.Should().Be(processName);
            request.Inputs.Should().HaveCount(4);
            request.Outputs.Should().HaveCount(1);
            request.ResponseType.Should().Be(ResponseType.Document);
            request.ExecutionMode.Should().Be(ExecutionMode.Asynchronous);
        }