public void EqualsStatic_UnionAIsDefaultAndUnionBIsDefault_ExpectTrue() { var unionA = default(TaggedUnion <RefType, StructType>); var unionB = new TaggedUnion <RefType, StructType>(); var actual = TaggedUnion <RefType, StructType> .Equals(unionA, unionB); Assert.True(actual); }
public void Equals_UnionAIsDefaultAndUnionBIsFirst_ExpectFalse() { var unionA = default(TaggedUnion <RefType?, StructType>); var unionB = TaggedUnion <RefType?, StructType> .First(null); var actual = TaggedUnion.Equals(unionA, unionB); Assert.False(actual); }
public void EqualsStatic_UnionASecondValueEqualsUnionBSecondValue_ExpectTrue() { var unionA = TaggedUnion <StructType, RefType?> .Second(MinusFifteenIdRefType); var unionB = (TaggedUnion <StructType, RefType?>)MinusFifteenIdRefType; var actual = TaggedUnion <StructType, RefType?> .Equals(unionA, unionB); Assert.True(actual); }
public void Equals_UnionAFirstValueEqualsUnionBFirstValue_ExpectTrue( object?sourceValue) { var unionA = TaggedUnion <object?, StructType> .First(sourceValue); var unionB = TaggedUnion <object?, StructType> .First(sourceValue); var actual = TaggedUnion.Equals(unionA, unionB); Assert.True(actual); }
public void EqualsStatic_UnionAFirstValueEqualsUnionBFirstValue_ExpectTrue() { var aValue = new StructType { Text = SomeString }; var unionA = TaggedUnion <StructType, RefType?> .First(aValue); var bValue = new StructType { Text = SomeString }; var unionB = (TaggedUnion <StructType, RefType?>)bValue; var actual = TaggedUnion <StructType, RefType?> .Equals(unionA, unionB); Assert.True(actual); }
public void Equals_UnionASecondValueEqualsUnionBSecondValue_ExpectTrue() { var text = "some-text"; var aValue = new StructType { Text = text }; var unionA = TaggedUnion <RefType, StructType> .Second(aValue); var bValue = new StructType { Text = text }; var unionB = (TaggedUnion <RefType, StructType>)bValue; var actual = TaggedUnion.Equals(unionA, unionB); Assert.True(actual); }
public static bool Equals(TaggedUnion <TFirst, TSecond> left, TaggedUnion <TFirst, TSecond> right) => left.Equals(right);