コード例 #1
0
        public void Given_InvalidMethod_When_GetExpanderRequestAsync_Invoked_Then_It_Should_Throw_Exception(string method, string shortUrl)
        {
            var req = new Mock <HttpRequest>();

            req.SetupGet(p => p.Method).Returns(method);

            Func <Task> func = async() => await HttpRequestExtensions.GetExpanderRequestAsync(req.Object, shortUrl).ConfigureAwait(false);

            func.Should().Throw <InvalidOperationException>();
        }
コード例 #2
0
        public async Task Given_Query_When_GetExpanderRequestAsync_Invoked_Then_It_Should_Return_Result(string method, string shortUrl)
        {
            var req = new Mock <HttpRequest>();

            req.SetupGet(p => p.Method).Returns(method);

            var result = await HttpRequestExtensions.GetExpanderRequestAsync(req.Object, shortUrl).ConfigureAwait(false);

            result.Should().NotBeNull();
            result.ShortUrl.Should().Be(shortUrl);
        }
コード例 #3
0
        public void Given_Null_When_GetExpanderRequestAsync_Invoked_Then_It_Should_Throw_Exception()
        {
            var req = new Mock <HttpRequest>();

            Func <Task> func = async() => await HttpRequestExtensions.GetExpanderRequestAsync(null, null).ConfigureAwait(false);

            func.Should().Throw <ArgumentNullException>();

            func = async() => await HttpRequestExtensions.GetExpanderRequestAsync(req.Object, null).ConfigureAwait(false);

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