コード例 #1
0
        public void MultipleFieldsAreSeparated()
        {
            var helper = new QueryHelper(ValidHostname);
            helper.AppendField("name", "indiana-jones");
            helper.AppendField("occupation", "archaeologist");

            Assert.Equal("test.com?name=indiana-jones&occupation=archaeologist",
                helper.ToString());
        }
コード例 #2
0
        public void AddingNullFieldValueAddsEmptyField()
        {
            var helper = new QueryHelper(ValidHostname);
            helper.AppendField("name", null);

            Assert.Equal("test.com?name=", helper.ToString());
        }
コード例 #3
0
        public void AddingValidFieldValueAddsField()
        {
            var helper = new QueryHelper(ValidHostname);
            helper.AppendField("name", "indiana-jones");

            Assert.Equal("test.com?name=indiana-jones", helper.ToString());
        }
コード例 #4
0
        public void AddingNullFieldThrowsException()
        {
            var result = new QueryHelper(ValidHostname);

            Assert.Throws(typeof (ArgumentOutOfRangeException), () =>
            {
                result.AppendField(null, "Anything");
            });
        }