Beispiel #1
0
        public void ArrayByValueOutParameter()
        {
            var testArray = new IntStructWrapper[10];
            int start     = 5;

            NativeExportsNE.Arrays.FillRangeArray(testArray, testArray.Length, start);

            Assert.Equal(Enumerable.Range(start, 10), testArray.Select(wrapper => wrapper.Value));
        }
Beispiel #2
0
        public void Array_ByValueOut()
        {
            {
                var testArray = new IntStructWrapper[10];
                int start     = 5;

                NativeExportsNE.Arrays.FillRangeArray(testArray, testArray.Length, start);
                Assert.Equal(Enumerable.Range(start, testArray.Length), testArray.Select(wrapper => wrapper.Value));

                // Any items not populated by the invoke target should be initialized to default
                testArray = new IntStructWrapper[10];
                int lengthToFill = testArray.Length / 2;
                NativeExportsNE.Arrays.FillRangeArray(testArray, lengthToFill, start);
                Assert.Equal(Enumerable.Range(start, lengthToFill), testArray[..lengthToFill].Select(wrapper => wrapper.Value));