public void CopiedMemberDescriptorEqualsItsSource() { var attributes = new Attribute[] { new CategoryAttribute("category"), new DescriptionAttribute("description") }; var firstDescriptor = new MockMemberDescriptor(nameof(MemberDescriptor), attributes); var copiedDescriptor = new MockMemberDescriptor(firstDescriptor); // call getters to ensure their backing fields aren't null Assert.Equal(firstDescriptor.Category, copiedDescriptor.Category); Assert.Equal(firstDescriptor.Description, copiedDescriptor.Description); Assert.True(firstDescriptor.Equals(copiedDescriptor)); }
public void CopiedMemberDescriptorEqualsItsSource() { string description = "MockCategory"; var attributes = new Attribute[] { new CategoryAttribute(description), // setting Decription and Category the same as .NET Framework has a bug in the equals that compares them // instead of each other. In .NET 4.6.2 and greater this is no longer an issue but to make the test // work on all platforms just setting them to be the same. new DescriptionAttribute(description) }; var firstDescriptor = new MockMemberDescriptor(nameof(MemberDescriptor), attributes); var copiedDescriptor = new MockMemberDescriptor(firstDescriptor); // call getters to ensure their backing fields aren't null Assert.Equal(firstDescriptor.Category, copiedDescriptor.Category); Assert.Equal(firstDescriptor.Description, copiedDescriptor.Description); Assert.True(firstDescriptor.Equals(copiedDescriptor)); }