public void UpdateRangeMatrixTest() { int[,] dstInt3x3Matrix = new int[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, }; Matrix dstMatrix = new Matrix(dstInt3x3Matrix, BuiltInType.Int32); // Update the center element Opc.Ua.NumericRange numericRange = Opc.Ua.NumericRange.Parse("1,1"); object dst = dstMatrix; StatusCode statusCode = numericRange.UpdateRange(ref dst, new int[, ] { { 10 } }); Assert.AreEqual(new StatusCode(StatusCodes.Good), statusCode); dstMatrix = dst as Matrix; Assert.NotNull(dstMatrix); int[,] modifiedInt3x3Matrix = dstMatrix.ToArray() as int[, ]; Assert.AreEqual(new int[, ] { { 1, 2, 3 }, { 4, 10, 6 }, { 7, 8, 9 }, }, modifiedInt3x3Matrix); }
public void UpdateStringArrayTest() { // Update the middle element "Test2" to "That2" by modifying "es" to "ha". Opc.Ua.NumericRange numericRange = Opc.Ua.NumericRange.Parse("1,1:2"); object dst = new string[] { "Test1", "Test2", "Test3" }; StatusCode statusCode = numericRange.UpdateRange(ref dst, new string[] { "ha" }); Assert.AreEqual(new StatusCode(StatusCodes.Good), statusCode); string[] updatedValue = dst as string[]; Assert.NotNull(updatedValue); Assert.AreEqual(new string[] { "Test1", "That2", "Test3" }, updatedValue); }
public void UpdateByteStringArrayTest() { // Update the middle element <0x55, 0x66, 0x77, 0x88> to <0x55, 0xDD, 0xEE, 0x88> by modifying 0x66 to 0xDD and 0x77 to 0xEE. Opc.Ua.NumericRange numericRange = Opc.Ua.NumericRange.Parse("1,1:2"); object dst = new byte[][] { new byte[] { 0x11, 0x22, 0x33, 0x44 }, new byte[] { 0x55, 0x66, 0x77, 0x88 }, new byte[] { 0x99, 0xAA, 0xBB, 0xCC } }; StatusCode statusCode = numericRange.UpdateRange(ref dst, new byte[][] { new byte[] { 0xDD, 0xEE } }); Assert.AreEqual(new StatusCode(StatusCodes.Good), statusCode); byte[][] updatedValue = dst as byte[][]; Assert.NotNull(updatedValue); Assert.AreEqual(new byte[][] { new byte[] { 0x11, 0x22, 0x33, 0x44 }, new byte[] { 0x55, 0xDD, 0xEE, 0x88 }, new byte[] { 0x99, 0xAA, 0xBB, 0xCC } }, updatedValue); }