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


C# Address.GetHashCode方法代码示例

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


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

示例1: HashCode_ignores_machine_name

        public void HashCode_ignores_machine_name()
        {
            Address.IgnoreMachineName();

            var address1 = new Address("MyEndpoint", "Server1");
            var address2 = new Address("MyEndpoint", "Server2");

            Assert.AreEqual(address1.GetHashCode(), address2.GetHashCode());
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:9,代码来源:AddressTests.cs

示例2: Value_Objects_Should_Be_Same_If_Contains_Same_Data

        public void Value_Objects_Should_Be_Same_If_Contains_Same_Data()
        {
            var address1 = new Address(new Guid("21C67A65-ED5A-4512-AA29-66308FAAB5AF"), "Baris Manco Street", 42);
            var address2 = new Address(new Guid("21C67A65-ED5A-4512-AA29-66308FAAB5AF"), "Baris Manco Street", 42);

            Assert.Equal(address1, address2);
            Assert.Equal(address1.GetHashCode(), address2.GetHashCode());
            Assert.True(address1 == address2);
            Assert.False(address1 != address2);
        }
开发者ID:vytautask,项目名称:aspnetboilerplate,代码行数:10,代码来源:ValueObject_Simple_Tests.cs

示例3: DiferentDataInDiferentPropertiesProduceDiferentHashCodeTest

        public void DiferentDataInDiferentPropertiesProduceDiferentHashCodeTest()
        {
            //Arrange
            Address address1 = new Address("streetLine1", "streetLine2", null, null);
            Address address2 = new Address("streetLine2", "streetLine1", null, null);

            //Act
            int address1HashCode = address1.GetHashCode();
            int address2HashCode = address2.GetHashCode();

            //Assert
            Assert.AreNotEqual(address1HashCode, address2HashCode);
        }
开发者ID:gabrielsimas,项目名称:MicrosoftNLayerApp,代码行数:13,代码来源:ValueObjectTests.cs

示例4: AddressEquality

        public void AddressEquality()
        {
            Dictionary<string, object> address = new Dictionary<string, object> { { "Existence", "Exists" }, { "Published", false } };
            var ii0 = new Address(typeof(HeaderContent), "abc&def");
            var ii1 = new Address(typeof(HeaderContent), "abc&def");
            var ii2 = new Address(typeof(RestaurantContent), "abc&def");
            var ii3 = new Address(typeof(HeaderContent), "abc");

            Assert.IsTrue(ii0.Equals(ii1), ".Equals true");
            Assert.IsTrue(ii0 == ii1, "== true");
            Assert.IsFalse(ii0.Equals(ii2), ".Equals false by type");
            Assert.IsFalse(ii0 == ii2, "== false by different val");
            Assert.IsFalse(ii1.Equals(ii3), ".Equals false by missing key");
            Assert.IsFalse(ii1 == ii3, "== false by missing key");

            Assert.IsFalse(ii0.GetHashCode() == ii2.GetHashCode(), "hash code by type");
            Assert.IsFalse(ii1.GetHashCode() == ii3.GetHashCode(), "hash code by missing key");
        }
开发者ID:jamesej,项目名称:lynicon,代码行数:18,代码来源:AddressTests.cs

示例5: SameDataSameHashCodeTest

        public void SameDataSameHashCodeTest()
        {
            //Arrange
            Address address1 = new Address("streetLine1", "streetLine2", null, null);
            Address address2 = new Address("streetLine1", "streetLine2", null, null);

            //Act
            int address1HashCode = address1.GetHashCode();
            int address2HashCode = address2.GetHashCode();

            //Assert
            Assert.AreEqual(address1HashCode, address2HashCode);
        }
开发者ID:gabrielsimas,项目名称:MicrosoftNLayerApp,代码行数:13,代码来源:ValueObjectTests.cs

示例6: SameDataInDiferentPropertiesProduceDiferentHashCodeTest

      public void SameDataInDiferentPropertiesProduceDiferentHashCodeTest()
      {
         //Arrange
         var address1 = new Address("streetLine1", null, null, "streetLine1");
         var address2 = new Address(null, "streetLine1", "streetLine1", null);

         //Act
         var address1HashCode = address1.GetHashCode();
         var address2HashCode = address2.GetHashCode();

         //Assert
         Assert.AreNotEqual(address1HashCode, address2HashCode);
      }
开发者ID:MyLobin,项目名称:NLayerAppV2,代码行数:13,代码来源:ValueObjectTests.cs

示例7: Ensure_that_hash_code_can_be_generated

 public void Ensure_that_hash_code_can_be_generated()
 {
     var address = new Address("street", "unit", "city", "nV", "01134");
     Assert.AreEqual(-2039642170, address.GetHashCode());
 }
开发者ID:killthrush,项目名称:DomainLayerSample,代码行数:5,代码来源:AddressTests.cs


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