Microsoft.Ccr.Core.VariableArgumentTaskTest.ItemPropertyBounds C# (CSharp) Method

ItemPropertyBounds() private method

private ItemPropertyBounds ( ) : void
return void
        public void ItemPropertyBounds()
        {
            int cnt = 1;
            var task = new VariableArgumentTask<int> (5, (a) => cnt += a.Length);

            try {
                task [-1] = new PortElement<int> (10);
                Assert.Fail ("#1");
            } catch (IndexOutOfRangeException) {}

            try {
                task [5] = new PortElement<int> (10);
                Assert.Fail ("#2");
            } catch (IndexOutOfRangeException) {}

            try {
                var obj = task [-1];
                Assert.Fail ("#3");
            } catch (IndexOutOfRangeException) {}

            try {
                var obj = task [5];
                Assert.Fail ("#4");
            } catch (IndexOutOfRangeException) {}
        }