当前位置: 首页>>代码示例>>C#>>正文


C# Token.Equals方法代码示例

本文整理汇总了C#中Token.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Token.Equals方法的具体用法?C# Token.Equals怎么用?C# Token.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Token的用法示例。


在下文中一共展示了Token.Equals方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Equals

 public void Equals()
 {
     var a = new Token(TokenType.StartScope);
     var b = new Token(TokenType.StartScope);
     Assert.AreEqual(a, a);
     Assert.AreEqual(a, b);
     Assert.IsFalse(a.Equals((Token)null));
     Assert.IsTrue(a.Equals(a));
     Assert.IsTrue(a.Equals((object)b));
 }
开发者ID:kbilsted,项目名称:StatePrinter,代码行数:10,代码来源:TokenTest.cs

示例2: TokensThatAreDifferent

        public void TokensThatAreDifferent()
        {
            var token = new Token(new Substring(" Hello ", 1, 5));
            var token2 = new Token(new Substring("\"Hello\"", 1, 5), true, true);

            token.Equals(token2).Should().BeFalse();
            token.Equals((object)token2).Should().BeFalse();
            (token == token2).Should().BeFalse();
            (token != token2).Should().BeTrue();
            token.GetHashCode().Should().NotBe(token2.GetHashCode());
        }
开发者ID:reubeno,项目名称:NClap,代码行数:11,代码来源:TokenTests.cs

示例3: TokensThatAreEqual

        public void TokensThatAreEqual()
        {
            var token = new Token(new Substring("Hello", 0, 2));
            var token2 = token;

            token.Equals(token2).Should().BeTrue();
            token.Equals((object)token2).Should().BeTrue();
            (token == token2).Should().BeTrue();
            (token != token2).Should().BeFalse();
            token.GetHashCode().Should().Be(token2.GetHashCode());
        }
开发者ID:reubeno,项目名称:NClap,代码行数:11,代码来源:TokenTests.cs

示例4: TokenComperator

        public void TokenComperator()
        {
            var server1 = new ServerWithAuthorizationCode("test", "testsecret",
                                                          new Uri("http://example.org/foo"),
                                                          new Uri("http://example.org/access"),
                                                          new Uri("http://example.org/test2"));
            var server2 = new ServerWithAuthorizationCode("test2", "testsecret",
                                                          new Uri("http://example.org/fo32o"),
                                                          new Uri("http://example.org/access"),
                                                          new Uri("http://example.org/tesdst2"));
            var resourceOwner1 = new ResourceOwner("testmann1");
            var resourceOwner2 = new ResourceOwner("testmann2");

            var token1 = new Token(server1,resourceOwner1);
            var token2 = new Token(server1,resourceOwner2);
            var token3 = new Token(server2,resourceOwner1);
            var token4 = new Token(server2,resourceOwner2);
            var token5 = new Token(server1,resourceOwner1);

            token1.Equals(token1).Should().BeTrue();
            token1.Equals(token2).Should().BeFalse();
            token1.Equals(token3).Should().BeFalse();
            token1.Equals(token4).Should().BeFalse();
            token1.Equals(token5).Should().BeTrue();

            (token1 == token5).Should().BeTrue();
            (token1 == token2).Should().BeFalse();
            (token1 != token2).Should().BeTrue();
            (token1 == null).Should().BeFalse();

            token1.Equals(42).Should().BeFalse();
            token1.Equals(null).Should().BeFalse();

        }
开发者ID:kokoar,项目名称:OAuth2.Net,代码行数:34,代码来源:TokenTests.cs

示例5: Equatable

        public void Equatable()
        {
            Token a = new Token() {
                Column = 19,
                LineNumber = 87,
                Content = String.Empty,
                Type = TokenType.String
            };

            Token b = new Token() {
                Column = 19,
                LineNumber = 87,
                Content = String.Empty,
                Type = TokenType.String
            };

            Assert.AreEqual(a, b, "does not work with Assert.AreEqual");
            Assert.IsTrue(a.Equals(b), "does not work with Equals");
        }
开发者ID:pingvinen,项目名称:penguinsyntax,代码行数:19,代码来源:TokenTests.cs

示例6: op_Equals_objectSame

        public void op_Equals_objectSame()
        {
            var obj = new Token("Example");

            Assert.True(obj.Equals(obj as object));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:6,代码来源:Token.Facts.cs

示例7: op_Equals_objectDiffer

        public void op_Equals_objectDiffer()
        {
            var obj = new Token("ABC");
            var comparand = new Token("XYZ");

            Assert.False(obj.Equals(comparand as object));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Token.Facts.cs

示例8: op_Equals_object

        public void op_Equals_object()
        {
            var obj = new Token("Example");
            var comparand = new Token("Example");

            Assert.True(obj.Equals(comparand as object));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Token.Facts.cs

示例9: op_Equals_TokenUnequal_StringComparison

        public void op_Equals_TokenUnequal_StringComparison()
        {
            var obj = new Token("ABC");
            var comparand = new Token("XYZ");

            Assert.False(obj.Equals(comparand, StringComparison.OrdinalIgnoreCase));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Token.Facts.cs

示例10: op_Equals_TokenUnequal

        public void op_Equals_TokenUnequal()
        {
            var obj = new Token("ABC");
            var comparand = new Token("XYZ");

            Assert.False(obj.Equals(comparand));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Token.Facts.cs

示例11: op_Equals_TokenSame

        public void op_Equals_TokenSame()
        {
            var obj = new Token("Example");
            var comparand = obj;

            Assert.True(obj.Equals(comparand));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Token.Facts.cs

示例12: op_Equals_TokenEqual_StringComparison

        public void op_Equals_TokenEqual_StringComparison()
        {
            var obj = new Token("EXAMPLE");
            var comparand = new Token("example");

            Assert.True(obj.Equals(comparand, StringComparison.OrdinalIgnoreCase));
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:Token.Facts.cs

示例13: TokenTests_Equals_Object_ShouldReturnFalseForDifferentType

        public void TokenTests_Equals_Object_ShouldReturnFalseForDifferentType()
        {
            // Arrange
            var lhs = new Token(TokenType.Number, "1", 0);
            var rhs = new Guid();

            // Act
            var result = lhs.Equals(rhs);

            // Assert
            Assert.IsFalse(result);
        }
开发者ID:tathamoddie,项目名称:RegexAnalyzer,代码行数:12,代码来源:TokenTests.cs

示例14: ATokenIsNotAString

 public void ATokenIsNotAString()
 {
     var token = new Token(new Substring("Hello", 0, 2));
     token.Equals("He").Should().BeFalse();
 }
开发者ID:reubeno,项目名称:NClap,代码行数:5,代码来源:TokenTests.cs


注:本文中的Token.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。