public void TestContract_Create() { var engine = GetEngine(false, true); var script = new byte[] { 0x01 }; Assert.ThrowsException <ArgumentException>(() => engine.CreateContract(script, new byte[ContractManifest.MaxLength + 1])); var manifest = TestUtils.CreateDefaultManifest(UInt160.Parse("0xa400ff00ff00ff00ff00ff00ff00ff00ff00ff01")); Assert.ThrowsException <InvalidOperationException>(() => engine.CreateContract(script, manifest.ToJson().ToByteArray(false))); manifest.Abi.Hash = script.ToScriptHash(); engine.CreateContract(script, manifest.ToJson().ToByteArray(false)); var snapshot = Blockchain.Singleton.GetSnapshot(); var state = TestUtils.GetContract(); snapshot.Contracts.Add(state.ScriptHash, state); engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0); engine.LoadScript(new byte[] { 0x01 }); Assert.ThrowsException <InvalidOperationException>(() => engine.CreateContract(state.Script, manifest.ToJson().ToByteArray(false))); }