Пример #1
0
        public void ShouldThrowExceptionWhenAssigningNonEnumerableToArray()
        {
            SinTDArray array = new SinTDArray();

            array.elementType = SinTDInstance.GetSinTDType("i32");

            Assert.Throws <TypeCastException>(
                () => { object[] arrayInstance = array.AssignValuesFromObject(1) as object[]; });
        }
Пример #2
0
        public void ShouldThrowExceptionWhenAssigningArrayWithWrongElementType()
        {
            var        floatArray = new float[] { 1f };
            SinTDArray array      = new SinTDArray();

            array.elementType = SinTDInstance.GetSinTDType("i32");

            Assert.Throws <TypeCastException>(
                () => { var arrayInstance = array.AssignValuesFromObject(floatArray) as object[]; });
        }
Пример #3
0
        public void ShouldAssignEmptyArray()
        {
            var        intArray = new int[] {};
            SinTDArray array    = new SinTDArray();

            array.elementType = SinTDInstance.GetSinTDType("i32");

            object[] arrayInstance = array.AssignValuesFromObject(intArray) as object[];
            Assert.AreEqual(0, arrayInstance.Length);
        }
Пример #4
0
        public void ShouldAssignArrayToArray()
        {
            var        intArray = new int[] { 1 };
            SinTDArray array    = new SinTDArray();

            array.elementType = SinTDInstance.GetSinTDType("i32");

            var arrayInstance = array.AssignValuesFromObject(intArray) as object[];

            Assert.AreEqual(1, arrayInstance.Length);
            Assert.AreEqual(1, (int)arrayInstance[0]);
        }
Пример #5
0
        public void ShouldAssignSetToArray()
        {
            var intSet = new HashSet <int> {
                1
            };
            SinTDArray array = new SinTDArray();

            array.elementType = SinTDInstance.GetSinTDType("i32");

            object[] arrayInstance = array.AssignValuesFromObject(intSet) as object[];
            Assert.AreEqual(1, arrayInstance.Length);
            Assert.AreEqual(1, (int)arrayInstance[0]);
        }
Пример #6
0
        public void ShouldThrowExceptionWhenAssigningNonEnumerableToArray()
        {
            SinTDArray array = new SinTDArray();
            array.elementType = SinTDInstance.GetSinTDType("i32");

            Assert.Throws<TypeCastException>(
                () => { object[] arrayInstance = array.AssignValuesFromObject(1) as object[]; });
        }
Пример #7
0
        public void ShouldThrowExceptionWhenAssigningArrayWithWrongElementType()
        {
            var floatArray = new float[] { 1f };
            SinTDArray array = new SinTDArray();
            array.elementType = SinTDInstance.GetSinTDType("i32");

            Assert.Throws<TypeCastException>(
                () => { var arrayInstance = array.AssignValuesFromObject(floatArray) as object[]; });
        }
Пример #8
0
        public void ShouldAssignSetToArray()
        {
            var intSet = new HashSet<int> { 1 };
            SinTDArray array = new SinTDArray();
            array.elementType = SinTDInstance.GetSinTDType("i32");

            object[] arrayInstance = array.AssignValuesFromObject(intSet) as object[];
            Assert.AreEqual(1, arrayInstance.Length);
            Assert.AreEqual(1, (int)arrayInstance[0]);
        }
Пример #9
0
        public void ShouldAssignEmptyArray()
        {
            var intArray = new int[] {};
            SinTDArray array = new SinTDArray();
            array.elementType = SinTDInstance.GetSinTDType("i32");

            object[] arrayInstance = array.AssignValuesFromObject(intArray) as object[];
            Assert.AreEqual(0, arrayInstance.Length);
        }
Пример #10
0
        public void ShouldAssignArrayToArray()
        {
            var intArray = new int[] { 1 };
            SinTDArray array = new SinTDArray();
            array.elementType = SinTDInstance.GetSinTDType("i32");

            var arrayInstance =  array.AssignValuesFromObject(intArray) as object[];
            Assert.AreEqual(1, arrayInstance.Length);
            Assert.AreEqual(1, (int)arrayInstance[0]);
        }