Beispiel #1
0
        public void Success()
        {
            var projectUid = Guid.NewGuid();
            var designUid  = Guid.NewGuid();

            var request        = new AlignmentGeometryRequest(projectUid, designUid, false, 0.0);
            var expectedResult = new AlignmentGeometryResult
                                 (
                0,
                new AlignmentGeometry
                (
                    designUid,
                    "",
                    new[] { new[] { new double[] { 1, 2, 3 } } },
                    new[] { new AlignmentGeometryResultArc(0, 1, 2, 3, 4, 5, 6, 7, 8, true) },
                    new[] { new AlignmentGeometryResultLabel(0, 1, 2, 3), }
                )
                                 );

            var tRexProxy = new Mock <ITRexCompactionDataProxy>();

            tRexProxy.Setup(x => x.SendDataGetRequest <AlignmentGeometryResult>(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IHeaderDictionary>(), It.IsAny <List <KeyValuePair <string, string> > >()))
            .ReturnsAsync(expectedResult);

            var executor = RequestExecutorContainerFactory
                           .Build <AlignmentGeometryExecutor>(logger, trexCompactionDataProxy: tRexProxy.Object, customHeaders: _customHeaders);

            var result = executor.ProcessAsync(request).Result as AlignmentGeometryResult;

            result.Should().NotBeNull();
            result.Should().BeEquivalentTo(expectedResult);
        }
Beispiel #2
0
        public void Failure()
        {
            var projectUid = Guid.NewGuid();
            var designUid  = Guid.NewGuid();

            var request = new AlignmentGeometryRequest(projectUid, designUid, false, 0.0);
            AlignmentGeometryResult expectedResult = null;

            var tRexProxy = new Mock <ITRexCompactionDataProxy>();

            tRexProxy.Setup(x => x.SendDataGetRequest <AlignmentGeometryResult>(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IHeaderDictionary>(), It.IsAny <List <KeyValuePair <string, string> > >()))
            .ReturnsAsync(expectedResult);

            var executor = RequestExecutorContainerFactory
                           .Build <AlignmentGeometryExecutor>(logger, trexCompactionDataProxy: tRexProxy.Object, customHeaders: _customHeaders);

            Action act = () => _ = executor.ProcessAsync(request).Result as AlignmentGeometryResult;

            act.Should().Throw <ServiceException>().WithMessage($"Failed to get alignment center line geometry for alignment: {designUid}");
        }