Exemple #1
0
        public void GetKnownRoute_ReturnsKnownRouteWhenRelativePathMatchesCaseMismatch()
        {
            var controller = new SoapController(loggerMock.Object, anonymousServiceClientMock.Object, authenticatedServiceClientMock.Object, cacheMock.Object);

            var service = new ServiceDTO
            {
                Code    = "dummy",
                Name    = "dummy",
                Id      = Guid.NewGuid(),
                Address = new Uri("http://address.to"),
                UnkownRoutesPassthrough = true,
                KnownRoutes             = new List <KnownRouteDTO>
                {
                    new KnownRouteDTO {
                        Id          = Guid.NewGuid(),
                        MethodName  = "POST",
                        RelativeUrl = "/Calculate.ASMX",
                        Action      = "Add"
                    }
                }
            };

            var result = controller.GetKnownRoute(service, "/Calculate.asmx", "Add");

            Assert.NotNull(result);

            Assert.Equal <Guid>(service.KnownRoutes[0].Id, result.Id);
        }
Exemple #2
0
        public void GetKnownRoute_ReturnsNullWhenActionIsNull()
        {
            var controller = new SoapController(loggerMock.Object, anonymousServiceClientMock.Object, authenticatedServiceClientMock.Object, cacheMock.Object);

            var service = new ServiceDTO
            {
                Code    = "dummy",
                Name    = "dummy",
                Id      = Guid.NewGuid(),
                Address = new Uri("http://address.to"),
                UnkownRoutesPassthrough = true,
                KnownRoutes             = new List <KnownRouteDTO> {
                    new KnownRouteDTO {
                        Id          = Guid.NewGuid(),
                        MethodName  = "POST",
                        RelativeUrl = "/Calculate.asmx",
                        Action      = "Add"
                    }
                }
            };

            var result = controller.GetKnownRoute(service, "/Calculate.asmx", null);

            Assert.Null(result);
        }
Exemple #3
0
        public void GetKnownRoute_ThrowsExceptionWhenEmptyRelativePathPassed()
        {
            var controller = new SoapController(loggerMock.Object, anonymousServiceClientMock.Object, authenticatedServiceClientMock.Object, cacheMock.Object);

            var service = new ServiceDTO();

            Assert.Throws <ArgumentNullException>(() => controller.GetKnownRoute(service, "", null));
        }
Exemple #4
0
        public void ProcessReuqest_ThrowsExceptionWhenEmptyServiceCodeProvided()
        {
            var controller = new SoapController(loggerMock.Object, anonymousServiceClientMock.Object, authenticatedServiceClientMock.Object, cacheMock.Object);

            CancellationTokenSource cts = new CancellationTokenSource(1000);

            Assert.ThrowsAsync <ArgumentNullException>(async() => await controller.ProcessRequest(null, cts.Token));
        }
Exemple #5
0
        public void GetKnownRoute_ReturnsNullWhenKnownRoutesIsNull()
        {
            var controller = new SoapController(loggerMock.Object, anonymousServiceClientMock.Object, authenticatedServiceClientMock.Object, cacheMock.Object);

            var service = new ServiceDTO
            {
                Code    = "dummy",
                Name    = "dummy",
                Id      = Guid.NewGuid(),
                Address = new Uri("http://address.to"),
                UnkownRoutesPassthrough = true
            };

            var result = controller.GetKnownRoute(service, "/Calculate.asmx", "Add");

            Assert.Null(result);
        }