Esempio n. 1
0
        public void FailToReturnObjectThatIsNotAnArrayType()
        {
            var defaultValue = new int[] { 1, 2, 3 };

            var value = new AgnosticArrayValue(defaultValue);

            Assert.Throws <ArgumentException>(() =>
            {
                var covertedArray = value.ToArray <double>();
            });
        }
Esempio n. 2
0
        public void SuccessfullyReturnArrayOfSameType()
        {
            var defaultValue = new int[] { 1, 2, 3 };

            var value = new AgnosticArrayValue(defaultValue);

            var covertedArray = value.ToArray <int[]>();

            Assert.Collection(covertedArray,
                              i => Assert.Equal(defaultValue[0], i),
                              i => Assert.Equal(defaultValue[1], i),
                              i => Assert.Equal(defaultValue[2], i));
            Assert.Equal(defaultValue.GetType(), value.Value.GetType());
        }