Ejemplo n.º 1
0
            public void StructuralEqualityElements_ShouldBeEqual()
            {
                // These 2 arrays *should not* be equal because they *do not* use structural equality.
                var array1 = new[] { "A", "B", "C" };
                var array2 = new[] { "A", "B", "C" };

                Assert.AreNotSame(array1, array2);
                Assert.AreNotEqual(array1, array2);

                // These 2 arrays *should* be equal because they *do* use structural equality.
                var valueArray1 = new ImmutableValueArray <string>(array1);
                var valueArray2 = new ImmutableValueArray <string>(array2);

                Assert.AreNotSame(valueArray1, valueArray2);
                Assert.AreEqual(valueArray1, valueArray2);
            }
Ejemplo n.º 2
0
            public void ReferenceEqualityElements_ShouldNotBeEqual()
            {
                // These 2 arrays *should not* be equal because they *do not* use structural equality.
                var array1 = new object[] { new(), new(), new() };
                var array2 = new object[] { new(), new(), new() };

                Assert.AreNotSame(array1, array2);
                Assert.AreNotEqual(array1, array2);

                // These 2 arrays also *should not* be equal.
                // Even though they use structural equality, the elements inside *do not*.
                var valueArray1 = new ImmutableValueArray <object>(array1);
                var valueArray2 = new ImmutableValueArray <object>(array2);

                Assert.AreNotSame(valueArray1, valueArray2);
                Assert.AreNotEqual(valueArray1, valueArray2);
            }
Ejemplo n.º 3
0
 public ObjectModelTypeWithList(params ObjectModelTypeWithValue <TValue>[] objects)
 {
     Objects = new ImmutableValueArray <ObjectModelTypeWithValue <TValue> >(objects);
 }