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>(); }
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); }
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>(); }