public void ModificationTest() { var p = new BinaryParameter(null, "myBinaryId", "myBinaryName", _defValue); p.OnChanged += ParamOnChanged; _passedOnChanged = false; p.Value = _defValue; Assert.IsFalse(_passedOnChanged, "OnChanged called without a cause"); Assert.IsFalse(p.IsModified, "IsModified = true but must be false"); _passedOnChanged = false; p.Value = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 0 }; Assert.IsTrue(_passedOnChanged, "OnChanged call missing"); Assert.IsTrue(p.IsModified, "IsModified = false but must be true"); _passedOnChanged = false; p.Value = null; Assert.IsTrue(_passedOnChanged, "OnChanged call missing"); Assert.IsTrue(p.IsModified, "IsModified = false but must be true"); _passedOnChanged = false; p.Value = new byte[] { 10, 21, 32, 43 }; Assert.IsTrue(_passedOnChanged, "OnChanged call missing"); Assert.IsTrue(p.IsModified, "IsModified = false but must be true"); p.OnChanged -= ParamOnChanged; _passedOnChanged = false; p.Value = new byte[] { 50, 61, 72, 83, 234, 29 }; Assert.IsFalse(_passedOnChanged, "OnChanged not allowed but occurred"); Assert.IsTrue(p.IsModified, "IsModified = false but must be true"); p.ResetModifiedState(); Assert.IsFalse(p.IsModified, "IsModified = false but must be true"); }
public void BufferTest() { var p = new BinaryParameter(null, "myBinaryId", "myBinaryName", _defValue) { Value = new byte[] { 50, 61, 72, 83, 234, 29, 44, 71 } }; p.ResetModifiedState(); Assert.IsTrue(p.BufferedValue.SequenceEqual(p.Value), "BufferedValue not set correctly"); }