public void TestRandomZombieGenerator() { ZombieFactory factory = new ZombieFactory(SmartContractState, 20); factory.CreateRandomZombie("drew"); factory.CreateRandomZombie("verity"); Assert.AreEqual((uint)2, factory.Zombies.Count); }
public void TestZombieLists() { const string zombNameKey = "ZombieNames"; const string zombDnaKey = "ZombieDNAs"; const string zombNameValue = "ferdeen"; var contract = new ZombieFactory(smartContractState); Assert.AreEqual(0uL, smartContractState.PersistentState.GetList <string>(zombNameKey).Count); Assert.AreEqual(0uL, smartContractState.PersistentState.GetList <uint>(zombDnaKey).Count); uint id = contract.CreateRandomZombie(zombNameValue); Assert.AreEqual(1uL, smartContractState.PersistentState.GetList <string>(zombNameKey).Count); Assert.AreEqual(zombNameValue, smartContractState.PersistentState.GetList <string>(zombNameKey).Get(0)); Assert.AreEqual(1uL, smartContractState.PersistentState.GetList <uint>(zombDnaKey).Count); Assert.AreEqual(id, smartContractState.PersistentState.GetList <uint>(zombDnaKey).Get(0)); }