Beispiel #1
0
        public void Equals_UsesDeepEqualsForJsonObjects()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter(new JObject
            {
                ["field"] = new JArray(new[] { 0, 1, 2, 3 })
            });

            // Act and assert
            Assert.True(parameter.Equals(new JObject
            {
                ["field"] = new JArray(new[] { 0, 1, 2, 3 })
            }));

            Assert.False(parameter.Equals(new JObject()));

            Assert.False(parameter.Equals(new JObject
            {
                ["field"] = "value"
            }));

            Assert.False(parameter.Equals(new JObject
            {
                ["field"] = new JArray(new[] { 0, 1, 2 })
            }));
        }
Beispiel #2
0
        public void Equals_SupportsJsonValues()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter(42);

            // Act and assert
            Assert.True(parameter.Equals(new OpenIdConnectParameter(new JValue(42))));
            Assert.False(parameter.Equals(new OpenIdConnectParameter(new JValue(100))));
        }
Beispiel #3
0
        public void Equals_UsesSequenceEqualForArrays()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter(new[] { "Fabrikam", "Contoso" });

            // Act and assert
            Assert.True(parameter.Equals(new string[] { "Fabrikam", "Contoso" }));
            Assert.False(parameter.Equals(new string[] { "Contoso", "Fabrikam" }));
        }
        public void Equals_UsesDeepEqualsForJsonArrays()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter(new JArray(new[] { 0, 1, 2, 3 }));

            // Act and assert
            Assert.True(parameter.Equals(new JArray(new[] { 0, 1, 2, 3 })));
            Assert.False(parameter.Equals(new JArray(new[] { 3, 2, 1, 0 })));
        }
Beispiel #5
0
        public void Equals_ComparesUnderlyingValuesForJsonValues()
        {
            // Arrange
            var value     = new JValue(42);
            var parameter = new OpenIdConnectParameter(value);

            // Act and assert
            Assert.True(parameter.Equals(new OpenIdConnectParameter(42)));
            Assert.False(parameter.Equals(new OpenIdConnectParameter(100)));
        }
Beispiel #6
0
        public void Equals_ReturnsFalseWhenOtherValueIsNull()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter(42);

            // Act and assert
            Assert.False(parameter.Equals(new OpenIdConnectParameter()));
        }
Beispiel #7
0
        public void Equals_ReturnsTrueWhenBothParametersAreNull()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter();

            // Act and assert
            Assert.True(parameter.Equals(new OpenIdConnectParameter()));
        }
Beispiel #8
0
        public void Equals_ReturnsFalseForNonParameters()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter();

            // Act and assert
            Assert.False(parameter.Equals(new object()));
        }
Beispiel #9
0
        public void Equals_SupportsNullJsonValues()
        {
            // Arrange
            var parameter = new OpenIdConnectParameter(42);

            // Act and assert
            Assert.False(parameter.Equals(new OpenIdConnectParameter(new JValue((long?)null))));
        }
Beispiel #10
0
        public void Equals_ReturnsTrueWhenReferencesAreIdentical()
        {
            // Arrange
            var value     = new JObject();
            var parameter = new OpenIdConnectParameter(value);

            // Act and assert
            Assert.True(parameter.Equals(new OpenIdConnectParameter(value)));
        }