Пример #1
0
        public void Initialization_TypeArguments()
        {
            var elementType = CustomTypeObjectMother.Create(typeArguments: new[] { ReflectionObjectMother.GetSomeType() });
            var type        = ArrayTypeBaseObjectMother.Create(elementType);

            Assert.That(type.GetGenericArguments(), Is.Empty);
        }
Пример #2
0
        public void Equals_Object()
        {
            var type1 = ArrayTypeBaseObjectMother.Create(CustomTypeObjectMother.Create(), _rank);
            var type2 = ArrayTypeBaseObjectMother.Create(_elementType, 3);
            var type3 = ArrayTypeBaseObjectMother.Create(_elementType, _rank);

            Assert.That(_type.Equals((object)null), Is.False);
            Assert.That(_type.Equals(new object()), Is.False);
            Assert.That(_type.Equals((object)type1), Is.False);
            Assert.That(_type.Equals((object)type2), Is.False);
            Assert.That(_type.Equals((object)type3), Is.True);

            var multiDimensionalArrayOfRank1 = MultiDimensionalArrayTypeObjectMother.Create(_elementType, 1);
            var vector = VectorTypeObjectMother.Create(_elementType);

            Assert.That(multiDimensionalArrayOfRank1.Equals((object)vector), Is.False);
        }
Пример #3
0
        public void Equals_Type()
        {
            var type1 = ArrayTypeBaseObjectMother.Create(CustomTypeObjectMother.Create(), _rank);
            var type2 = ArrayTypeBaseObjectMother.Create(_elementType, 3);
            var type3 = ArrayTypeBaseObjectMother.Create(_elementType, _rank);

// ReSharper disable CheckForReferenceEqualityInstead.1
            Assert.That(_type.Equals(null), Is.False);
// ReSharper restore CheckForReferenceEqualityInstead.1
            Assert.That(_type.Equals(type1), Is.False);
            Assert.That(_type.Equals(type2), Is.False);
            Assert.That(_type.Equals(type3), Is.True);

            var multiDimensionalArrayOfRank1 = MultiDimensionalArrayTypeObjectMother.Create(_elementType, 1);
            var vector = VectorTypeObjectMother.Create(_elementType);

            Assert.That(multiDimensionalArrayOfRank1.Equals(vector), Is.False);
        }
Пример #4
0
        public new void GetHashCode()
        {
            var type = ArrayTypeBaseObjectMother.Create(_elementType, _rank);

            Assert.That(_type.GetHashCode(), Is.EqualTo(type.GetHashCode()));
        }