public void Should_not_allow_to_append_to_path_after_appending_to_query()
        {
            var builder = new RequestUrlBuilder();

            builder.AppendToPath("foo/");

            builder.AppendToQuery("key", "value");

            Action action = () => builder.AppendToPath("bar");

            action.Should().Throw <InvalidOperationException>().Which.ShouldBePrinted();
        }
        public void Should_not_be_usable_after_producing_an_url()
        {
            var builder = new RequestUrlBuilder
            {
                "foo/", "bar/", "baz"
            };

            builder.Build();

            Action pathAppend  = () => builder.AppendToPath("123");
            Action queryAppend = () => builder.AppendToQuery("123", "456");

            pathAppend.Should().Throw <ObjectDisposedException>().Which.ShouldBePrinted();
            queryAppend.Should().Throw <ObjectDisposedException>().Which.ShouldBePrinted();
        }
示例#3
0
 public static RequestUrlBuilder AppendDateToPath(this RequestUrlBuilder builder, DateTime date)
 {
     return(builder.AppendToPath(date.Date.ToString("yyyy-MM-dd")));
 }