Ejemplo n.º 1
0
        public void SetUp()
        {
            var t = new Netomity.Interfaces.Basic.Fakes.StubBasicInterface();

            _ha = new Netomity.Interfaces.HA.Fakes.StubHAInterface(iface: t);
            _m  = new Motion(iface: _ha);
        }
Ejemplo n.º 2
0
        public void SimpleMapDictTest()
        {
            const string          testString = "This is a test";
            NotificationParamType testKey    = NotificationParamType.Subject;
            const string          testValue  = "value1";
            Command pCommand = null;
            var     i        = new Netomity.Interfaces.Basic.Fakes.StubBasicInterface();
            var     ha       = new Netomity.Interfaces.HA.Fakes.StubHAInterface(iface: i);

            ha.CommandCommand = (command) => { pCommand = command; return(Task.Run(() => { return true; })); };
            var m = new MapCommand(primaryInput: CommandType.On,
                                   primaryOutput: CommandType.Off,
                                   secondaryOutput: testString,
                                   stringParams: new Dictionary <StringEnum, string>()
            {
                { testKey, testValue }
            });
            var sd = new StateDevice(iface: ha, behaviors: new List <BehaviorBase>()
            {
                m
            });

            Assert.AreEqual(StateType.Unknown, sd.State.Primary);
            var r = sd.On();

            Assert.IsTrue(r.Result);
            Assert.AreEqual(StateType.Off, sd.State.Primary);
            Assert.AreEqual(CommandType.Off, pCommand.Primary);
            Assert.AreEqual(testString, pCommand.Secondary);
            Assert.AreEqual(testValue, pCommand.StringParams[testKey]);
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            _data = null;
            _t    = new Netomity.Interfaces.Basic.Fakes.StubBasicInterface()
            {
                SendString = (data) => { _data = data; },
            };

            _i = new W800(iface: _t);
        }