Beispiel #1
0
        public void ToJson()
        {
            uut.Attributes = new TransactionAttribute[0];
            uut.Inputs     = new CoinReference[0];
            uut.Outputs    = new TransactionOutput[0];
            uut.Witnesses  = new Witness[0];
            uut.Nonce      = 42;

            JObject jObj = uut.ToJson();

            jObj.Should().NotBeNull();
            jObj["txid"].AsString().Should().Be("0xe42ca5744eda6de2e1a2bdc2ed98fa7b967b13cd3aa2605c95fff37261f07ef6");
            jObj["size"].AsNumber().Should().Be(10);
            jObj["type"].AsString().Should().Be("BlockReward");
            jObj["version"].AsNumber().Should().Be(0);
            ((JArray)jObj["attributes"]).Count.Should().Be(0);
            ((JArray)jObj["vin"]).Count.Should().Be(0);
            ((JArray)jObj["vout"]).Count.Should().Be(0);
            jObj["sys_fee"].AsNumber().Should().Be(0);
            jObj["net_fee"].AsNumber().Should().Be(0);
            ((JArray)jObj["scripts"]).Count.Should().Be(0);

            jObj["nonce"].AsNumber().Should().Be(42);
        }