Clone() public method

public Clone ( ) : object
return object
Beispiel #1
0
        public void CookieHeaderValue_Clone()
        {
            // Arrange
            NameValueCollection nvc = new NameValueCollection();

            nvc.Add("name", "value");
            CookieHeaderValue expectedValue = new CookieHeaderValue("cookie", nvc);

            expectedValue.Domain   = "domain";
            expectedValue.Expires  = DateTimeOffset.Now;
            expectedValue.MaxAge   = TimeSpan.FromDays(10);
            expectedValue.Path     = "path";
            expectedValue.HttpOnly = true;
            expectedValue.Secure   = true;

            // Act
            CookieHeaderValue actualValue = expectedValue.Clone() as CookieHeaderValue;

            // Assert
            Assert.Equal(expectedValue.ToString(), actualValue.ToString());
        }
        public void CookieHeaderValue_Clone()
        {
            // Arrange
            NameValueCollection nvc = new NameValueCollection();
            nvc.Add("name", "value");
            CookieHeaderValue expectedValue = new CookieHeaderValue("cookie", nvc);
            expectedValue.Domain = "domain";
            expectedValue.Expires = DateTimeOffset.Now;
            expectedValue.MaxAge = TimeSpan.FromDays(10);
            expectedValue.Path = "path";
            expectedValue.HttpOnly = true;
            expectedValue.Secure = true;

            // Act
            CookieHeaderValue actualValue = expectedValue.Clone() as CookieHeaderValue;

            // Assert
            Assert.Equal(expectedValue.ToString(), actualValue.ToString());
        }