コード例 #1
0
        public void Equals_Same_Value_Returns_True()
        {
            // Arrange
            var options1 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
#endif
            };

            var options2 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
#endif
            };

            // Act
            var equals = ProxyHttpRequestOptions.Equals(options1, options2);

            // Assert
            Assert.True(equals);
        }
コード例 #2
0
        public void Equals_Second_Null_Returns_False()
        {
            var options1 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
#endif
            };

            var equals = ProxyHttpRequestOptions.Equals(options1, null);

            Assert.False(equals);
        }
コード例 #3
0
        public void Equals_First_Null_Returns_False()
        {
            // Arrange
            var options2 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
#endif
            };

            // Act
            var equals = ProxyHttpRequestOptions.Equals(null, options2);

            // Assert
            Assert.False(equals);
        }
コード例 #4
0
        public void Equals_Different_Value_Returns_False()
        {
            // Arrange
            var options1 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
#endif
            };

            var options2 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version20,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrHigher
#endif
            };

            var options3 = new ProxyHttpRequestOptions
            {
                RequestTimeout = TimeSpan.FromSeconds(60),
                Version        = HttpVersion.Version11,
#if NET
                VersionPolicy = HttpVersionPolicy.RequestVersionOrLower
#endif
            };

            // Act
            var equals1 = ProxyHttpRequestOptions.Equals(options1, options2);
            var equals2 = ProxyHttpRequestOptions.Equals(options1, options3);

            // Assert
            Assert.False(equals1);
#if NET
            Assert.False(equals2);
#else
            Assert.True(equals2);
#endif
        }