ToString() public method

public ToString ( ) : string
return string
        public void CookieState_ItemTreatsNullNameAsEmpty()
        {
            // Arrange
            CookieState state = new CookieState("name", "value");

            // Act
            state[null] = "v1";

            // Assert
            Assert.Equal("name=value&=v1", state.ToString());
        }
示例#2
0
        public void CookieState_ToStringWithSingleValue()
        {
            // Arrange
            CookieState cookie = new CookieState("name", "value");

            // Act
            string actualValue = cookie.ToString();

            // Assert
            Assert.Equal("name=value", actualValue);
        }
        public void CookieState_ToStringWithSingleValue(string subValue, string encodedSubvalue)
        {
            // Arrange
            CookieState cookie = new CookieState("name", subValue);

            // Act
            string actualValue = cookie.ToString();

            // Assert
            string expectedValue = String.Format("name={0}", encodedSubvalue);

            Assert.Equal(expectedValue, actualValue);
        }
        public void CookieState_ItemEncodesValue(string subvalue, string encodedSubvalue)
        {
            // Arrange
            CookieState state = new CookieState("name", "value");

            // Act
            state["n1"] = subvalue;

            // Assert
            string value = String.Format("name=value&n1={0}", encodedSubvalue);

            Assert.Equal(value, state.ToString());
        }
        public void CookieState_ItemEncodesName(string subname, string encodedSubname)
        {
            // Arrange
            CookieState state = new CookieState("name", "value");

            // Act
            state[subname] = "v1";

            // Assert
            string value = String.Format("name=value&{0}=v1", encodedSubname);

            Assert.Equal(value, state.ToString());
        }
示例#6
0
        public void CookieState_ToStringWithNameValueCollection()
        {
            // Arrange
            NameValueCollection nvc = new NameValueCollection();

            nvc.Add("n1", "v1");
            nvc.Add("n2", "v2");
            nvc.Add("n3", "v3");
            CookieState cookie = new CookieState("name", nvc);

            // Act
            string actualValue = cookie.ToString();

            // Assert
            Assert.Equal("name=n1=v1&n2=v2&n3=v3", actualValue);
        }
        public void CookieState_ToStringWithNameValueCollection(string subValue, string encodedSubvalue)
        {
            // Arrange
            NameValueCollection nvc = new NameValueCollection();

            nvc.Add("n1", subValue);
            nvc.Add("n2", subValue);
            nvc.Add("n3", subValue);
            CookieState cookie = new CookieState("name", nvc);

            // Act
            string actualValue = cookie.ToString();

            // Assert
            string expectedValue = String.Format("name=n1={0}&n2={0}&n3={0}", encodedSubvalue);

            Assert.Equal(expectedValue, actualValue);
        }
        public void CookieState_ToStringWithNameValueCollection()
        {
            // Arrange
            NameValueCollection nvc = new NameValueCollection();
            nvc.Add("n1", "v1");
            nvc.Add("n2", "v2");
            nvc.Add("n3", "v3");
            CookieState cookie = new CookieState("name", nvc);

            // Act
            string actualValue = cookie.ToString();

            // Assert
            Assert.Equal("name=n1=v1&n2=v2&n3=v3", actualValue);
        }
        public void CookieState_ToStringWithSingleValue()
        {
            // Arrange
            CookieState cookie = new CookieState("name", "value");

            // Act
            string actualValue = cookie.ToString();

            // Assert
            Assert.Equal("name=value", actualValue);
        }
示例#10
0
        public void CookieState_ToStringWithNameValueCollection(string subValue, string encodedSubvalue)
        {
            // Arrange
            NameValueCollection nvc = new NameValueCollection();
            nvc.Add("n1", subValue);
            nvc.Add("n2", subValue);
            nvc.Add("n3", subValue);
            CookieState cookie = new CookieState("name", nvc);

            // Act
            string actualValue = cookie.ToString();

            // Assert
            string expectedValue = String.Format("name=n1={0}&n2={0}&n3={0}", encodedSubvalue);
            Assert.Equal(expectedValue, actualValue);
        }
示例#11
0
        public void CookieState_ToStringWithSingleValue(string subValue, string encodedSubvalue)
        {
            // Arrange
            CookieState cookie = new CookieState("name", subValue);

            // Act
            string actualValue = cookie.ToString();

            // Assert
            string expectedValue = String.Format("name={0}", encodedSubvalue);
            Assert.Equal(expectedValue, actualValue);
        }
示例#12
0
        public void CookieState_ItemEncodesValue(string subvalue, string encodedSubvalue)
        {
            // Arrange
            CookieState state = new CookieState("name", "value");

            // Act
            state["n1"] = subvalue;

            // Assert
            string value = String.Format("name=value&n1={0}", encodedSubvalue);
            Assert.Equal(value, state.ToString());
        }
示例#13
0
        public void CookieState_ItemEncodesName(string subname, string encodedSubname)
        {
            // Arrange
            CookieState state = new CookieState("name", "value");

            // Act
            state[subname] = "v1";

            // Assert
            string value = String.Format("name=value&{0}=v1", encodedSubname);
            Assert.Equal(value, state.ToString());
        }
示例#14
0
        public void CookieState_ItemTreatsNullNameAsEmpty()
        {
            // Arrange
            CookieState state = new CookieState("name", "value");

            // Act
            state[null] = "v1";

            // Assert
            Assert.Equal("name=value&=v1", state.ToString());
        }