Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Hanna <jon@hackcraft.net>2016-11-18 11:28:37 +0300
committerJon Hanna <jon@hackcraft.net>2016-11-18 13:34:55 +0300
commit52eb63649c6b67965115829dd82510e1c8cae804 (patch)
tree1071d52b0294b7d52df2c7b486920b08bcca0f8f /src/System.Drawing.Primitives/tests
parentd765ea13d24bbadbb422e373e0eebe272b546381 (diff)
Remove dead branches in Color.op_Equality
Color.op_Equality uses the common pattern for the name field of: 1. Return true on left is same instance as right. 2. Return false on left or right are null, since both null is considered above 3. Do fuller equality test. However since == is overloaded for string, step 1 is not as intended. Since string == does the same logic as above anyway, the rest are just three branches that will all return false. Cut out these branches, and just use string == directly. Also add test case for Color objects with equal, but not same- instance, names, as this case isn't covered in current tests.
Diffstat (limited to 'src/System.Drawing.Primitives/tests')
-rw-r--r--src/System.Drawing.Primitives/tests/ColorTests.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/System.Drawing.Primitives/tests/ColorTests.cs b/src/System.Drawing.Primitives/tests/ColorTests.cs
index 6bdcbc0d6a..3b5df94e40 100644
--- a/src/System.Drawing.Primitives/tests/ColorTests.cs
+++ b/src/System.Drawing.Primitives/tests/ColorTests.cs
@@ -493,6 +493,10 @@ namespace System.Drawing.Primitives.Tests
yield return new object[] { Color.FromName("SomeName"), Color.FromName("SomeOtherName"), false };
yield return new object[] { Color.FromArgb(0, 0, 0), default(Color), false };
+
+ string someNameConstructed = string.Join("", "Some", "Name");
+ Assert.NotSame("SomeName", someNameConstructed); // If this fails the above must be changed so this test is correct.
+ yield return new object[] {Color.FromName("SomeName"), Color.FromName(someNameConstructed), true};
}
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] // desktop incorrectly does "name.Equals(name)" in Equals