public void StartThermostat_Throws_If_Caller_Not_Installer()
        {
            ThermostatContract thermostat = this.NewThermostat();

            this.mockPersistentState.Setup(s => s.GetAddress(nameof(ThermostatContract.Installer))).Returns(this.installer);

            this.mockContractState.Setup(s => s.Message.Sender).Returns(Address.Zero);

            Assert.Throws <SmartContractAssertException>(() => thermostat.StartThermostat());
        }
        public void StartThermostat_Throws_If_Caller_Installer_But_State_Not_Created()
        {
            ThermostatContract thermostat = this.NewThermostat();

            this.mockPersistentState.Setup(s => s.GetUInt32(nameof(ThermostatContract.State))).Returns((uint)ThermostatContract.StateType.InUse);

            this.mockPersistentState.Setup(s => s.GetAddress(nameof(ThermostatContract.Installer))).Returns(this.installer);

            this.mockContractState.Setup(s => s.Message.Sender).Returns(this.installer);

            Assert.Throws <SmartContractAssertException>(() => thermostat.StartThermostat());
        }
        public void StartThermostat_Sets_State_InUse()
        {
            ThermostatContract thermostat = this.NewThermostat();

            this.mockPersistentState.Setup(s => s.GetUInt32(nameof(ThermostatContract.State))).Returns((uint)ThermostatContract.StateType.Created);

            this.mockPersistentState.Setup(s => s.GetAddress(nameof(ThermostatContract.Installer))).Returns(this.installer);

            this.mockContractState.Setup(s => s.Message.Sender).Returns(this.installer);

            thermostat.StartThermostat();

            this.mockPersistentState.Verify(s => s.SetUInt32(nameof(ThermostatContract.State), (uint)ThermostatContract.StateType.InUse));
        }