public void TestSetPrivateDataValidationParameter() { ChaincodeStub stub = new ChaincodeStub("myc", "txId", handler.Object, new List <ByteString>(), null); byte[] value = new byte[] { 0x10, 0x20, 0x30 }; //handler.Setup(a => a.PutStateMetadataAsync("myc", "txId", "testcoll", "key", ChaincodeStub.VALIDATION_PARAMETER, ByteString.CopyFrom(value), token)); stub.SetPrivateDataValidationParameter("testcoll", "key", value); handler.Verify(a => a.PutStateMetadataAsync("myc", "txId", "testcoll", "key", ChaincodeStub.VALIDATION_PARAMETER, ByteString.CopyFrom(value), token)); try { stub.SetPrivateDataValidationParameter(null, "key", value); Assert.Fail("Null collection check fails"); } catch (ArgumentException) { //Ignore } try { stub.SetPrivateDataValidationParameter("", "key", value); Assert.Fail("Empty collection check fails"); } catch (ArgumentException) { //Ignore } try { stub.SetPrivateDataValidationParameter("testcoll", null, value); Assert.Fail("Null key check fails"); } catch (ArgumentException) { //Ignore } try { stub.SetPrivateDataValidationParameter("testcoll", "", value); Assert.Fail("Empty key check fails"); } catch (ArgumentException) { //Ignore } }