예제 #1
0
        public void Given_NullOptions_When_GetScheme_Invoked_Then_It_Should_Return_Result(string scheme, string expected)
        {
            var req = new Mock <IHttpRequestDataObject>();

            req.SetupGet(p => p.Scheme).Returns(scheme);

            var result = HttpRequestDataObjectExtensions.GetScheme(req.Object, null);

            result.Should().Be(expected);
        }
예제 #2
0
        public void Given_Options_When_GetScheme_Invoked_Then_It_Should_Return_Result(string scheme, bool forceHttps, bool forceHttp, string expected)
        {
            var req = new Mock <IHttpRequestDataObject>();

            req.SetupGet(p => p.Scheme).Returns(scheme);

            var options = new Mock <IOpenApiConfigurationOptions>();

            options.SetupGet(p => p.ForceHttps).Returns(forceHttps);
            options.SetupGet(p => p.ForceHttp).Returns(forceHttp);

            var result = HttpRequestDataObjectExtensions.GetScheme(req.Object, options.Object);

            result.Should().Be(expected);
        }
예제 #3
0
        public void Given_Null_When_GetScheme_Invoked_Then_It_Should_Throw_Exception()
        {
            Action action = () => HttpRequestDataObjectExtensions.GetScheme(null, null);

            action.Should().Throw <ArgumentNullException>();
        }