コード例 #1
0
 public void ConcreteSleepFunctionConstructorTest1()
 {
     SleepFunction function   = new SleepFunction();
     IZoneServer   zoneServer = null;
     Dictionary <int, IAudioDriver> audioDrivers = null;
     ConcreteSleepFunction          target       = new ConcreteSleepFunction(function, zoneServer, audioDrivers);
 }
コード例 #2
0
        public void notifyOnZoneUpdateTest()
        {
            SleepFunction function   = new SleepFunction();
            IZoneServer   zoneServer = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteSleepFunction          target       = new ConcreteSleepFunction(function, zoneServer, audioDrivers);

            /* not supported anymore; quick-fix, uncomment unit test ->
             *
             * // notify the first time, the update time is set to the current update time
             * ZoneStateEventArgs e1 = new ZoneStateEventArgs( new NuvoControl.Common.ZoneState( new Address(100,1), true, 20, NuvoControl.Common.ZoneQuality.Online));
             * target.notifyOnZoneUpdate(e1);
             * Assert.AreEqual(e1.ZoneState.LastUpdate, target._lastZoneChangeToON);
             *
             * // notify volume change, the last zone change to On time stays the same
             * ZoneStateEventArgs e2 = new ZoneStateEventArgs(new NuvoControl.Common.ZoneState(new Address(100, 1), true, 30, NuvoControl.Common.ZoneQuality.Online));
             * target.notifyOnZoneUpdate(e2);
             * Assert.AreEqual(e1.ZoneState.LastUpdate, target._lastZoneChangeToON);
             *
             * // notify switch off, the last zone change to On time stays the same
             * ZoneStateEventArgs e3 = new ZoneStateEventArgs(new NuvoControl.Common.ZoneState(new Address(100, 1), false, 30, NuvoControl.Common.ZoneQuality.Online));
             * target.notifyOnZoneUpdate(e3);
             * Assert.AreEqual(e1.ZoneState.LastUpdate, target._lastZoneChangeToON);
             *
             * // notify switch on, the last zone change to On time updates
             * ZoneStateEventArgs e4 = new ZoneStateEventArgs(new NuvoControl.Common.ZoneState(new Address(100, 1), true, 30, NuvoControl.Common.ZoneQuality.Online));
             * target.notifyOnZoneUpdate(e4);
             * Assert.AreEqual(e4.ZoneState.LastUpdate, target._lastZoneChangeToON);
             *
             */
        }
コード例 #3
0
        /// <summary>
        /// Unload the zone server. This object holds all zone controllers.
        /// </summary>
        private static void UnloadZoneServer()
        {
            LogHelper.Log(LogLevel.Info, String.Format(">>> Unload the zone server..."));

            _zoneServer.ShutDown();
            _zoneServer = null;
        }
コード例 #4
0
        public void isFunctionActiveTodayTest3()
        {
            IZoneServer zoneServer = null;

            // (1) Empty day list
            List <DayOfWeek> _dayOfWeeks1 = new List <DayOfWeek>();
            AlarmFunction    function1    = new AlarmFunction(
                SimpleId.NewGuid(),
                new Address(100, 1), new Address(100, 1), 50,
                new TimeSpan(6, 0, 0), new TimeSpan(0, 45, 0),
                _dayOfWeeks1);
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteAlarmFunction          target1      = new ConcreteAlarmFunction(function1, zoneServer, audioDrivers);

            // (2) Full day list
            List <DayOfWeek> _dayOfWeeks2 = new List <DayOfWeek>();

            _dayOfWeeks2.Add(DayOfWeek.Monday);
            _dayOfWeeks2.Add(DayOfWeek.Tuesday);
            _dayOfWeeks2.Add(DayOfWeek.Wednesday);
            _dayOfWeeks2.Add(DayOfWeek.Thursday);
            _dayOfWeeks2.Add(DayOfWeek.Friday);
            _dayOfWeeks2.Add(DayOfWeek.Saturday);
            _dayOfWeeks2.Add(DayOfWeek.Sunday);
            AlarmFunction function2 = new AlarmFunction(
                SimpleId.NewGuid(),
                new Address(100, 1), new Address(100, 1), 50,
                new TimeSpan(6, 0, 0), new TimeSpan(0, 45, 0),
                _dayOfWeeks2);
            ConcreteAlarmFunction target2 = new ConcreteAlarmFunction(function2, zoneServer, audioDrivers);

            // Monday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 7, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 7, 12, 0, 0)));

            // Tuesday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 8, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 8, 12, 0, 0)));

            // Wednesday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 9, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 9, 12, 0, 0)));

            // Thursday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 10, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 10, 12, 0, 0)));

            // Friday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 11, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 11, 12, 0, 0)));

            // Saturday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 12, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 12, 12, 0, 0)));

            // Sunday
            Assert.AreEqual(false, target1.isFunctionActiveToday(new DateTime(2009, 9, 13, 12, 0, 0)));
            Assert.AreEqual(true, target2.isFunctionActiveToday(new DateTime(2009, 9, 13, 12, 0, 0)));
        }
コード例 #5
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        internal virtual ConcreteFunction CreateConcreteFunction()
        {
            IZoneServer zoneServer = null;
            Function    function   = new FunctionTestClass();
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteFunction target = new ConcreteFunctionTestClass(function, zoneServer, audioDrivers);

            return(target);
        }
コード例 #6
0
 public void notifyOnZoneUpdateTest1()
 {
     ZoneChangeFunction             function     = new ZoneChangeFunction();
     IZoneServer                    zoneServer   = null;
     Dictionary <int, IAudioDriver> audioDrivers = null;
     ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
     ZoneStateEventArgs             e            = new ZoneStateEventArgs(new ZoneState());
     // not supported anymore; quick-fix, uncomment unit test ->  target.notifyOnZoneUpdate(e);
     //ok, pass without exception
 }
コード例 #7
0
 public ConcreteSendNuvoCommand(SendNuvoCommand command, IZoneServer zoneServer)
     : base(command)
 {
     _zoneServer = zoneServer;
     if (_zoneServer == null)
     {
         _log.Warn(m => m("Zone Server not available, cannot monitor any zone ..."));
     }
     _sendNuvoCommand = command;
 }
コード例 #8
0
        public void notifyOnZoneUpdateTest1()
        {
            ZoneChangeFunction                  function     = new ZoneChangeFunction();
            IZoneServer                         zoneServer   = null;
            Dictionary <int, IAudioDriver>      audioDrivers = null;
            ConcreteZoneChangeFunction_Accessor target       = new ConcreteZoneChangeFunction_Accessor(function, zoneServer, audioDrivers);
            ZoneStateEventArgs                  e            = new ZoneStateEventArgs(new ZoneState());

            target.notifyOnZoneUpdate(e);
            //ok, pass without exception
        }
コード例 #9
0
 /// <summary>
 /// Constructor to instantiate a concrete sleep function.
 /// </summary>
 /// <param name="function">Configuration data for this sleep function.</param>
 /// <param name="zoneServer">Zone server, to get notification about zone changes.</param>
 /// <param name="audioDrivers">Audio Drivers, in case a sound needs to be played.</param>
 public ConcreteSleepFunction(SleepFunction function, IZoneServer zoneServer, Dictionary <int, IAudioDriver> audioDrivers)
     : base(zoneServer, function, audioDrivers)
 {
     if (function == null)
     {
         onFunctionError();
         throw new FunctionServerException("Function configuration is null. This is not allowed");
     }
     _function = function;
     subscribeZone(_function.ZoneId);
 }
コード例 #10
0
        public void ActiveTest1()
        {
            ZoneChangeFunction             function     = new ZoneChangeFunction();
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            bool actual;

            actual = target.Active;
            Assert.AreEqual(true, actual);
        }
コード例 #11
0
        public void FunctionTest()
        {
            ZoneChangeFunction             function     = new ZoneChangeFunction();
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            Function actual;

            actual = target.Function;
            Assert.IsNotNull(actual);
        }
コード例 #12
0
        public void ConcreteZoneChangeFunctionConstructorTest()
        {
            List <Command> commands = new List <Command>();

            commands.Add(new SendNuvoCommand(new SimpleId(), true, true, true, true, true, true, true, new Address("100.1"), "OFF", "100.6", 10));
            ZoneChangeFunction             function     = new ZoneChangeFunction(new SimpleId(), new Address(), new Address(), 0, true, true, true, true, null, new TimeSpan(), new TimeSpan(), commands);
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            // No exception
        }
コード例 #13
0
        /// <summary>
        /// <see cref="IMonitorAndControl"/>
        /// </summary>
        public void Connect()
        {
            _log.Trace(m => m("M&C; Connect."));

            IMonitorAndControlNotification callback = OperationContext.Current.GetCallbackChannel <IMonitorAndControlNotification>();

            this._subscriber = callback;
            ServiceHostMc host = OperationContext.Current.Host as ServiceHostMc;

            Debug.Assert(host != null);
            _zoneServer = host.ZoneServer;
        }
コード例 #14
0
 public void ConcreteAlarmFunctionConstructorTest2()
 {
     List <DayOfWeek> _dayOfWeeks = new List <DayOfWeek>();
     AlarmFunction    function    = new AlarmFunction(
         SimpleId.NewGuid(),
         new Address(100, 1), new Address(100, 1), 50,
         new TimeSpan(6, 0, 0), new TimeSpan(0, 45, 0),
         _dayOfWeeks);
     IZoneServer zoneServer = null;
     Dictionary <int, IAudioDriver> audioDrivers = null;
     ConcreteAlarmFunction          target       = new ConcreteAlarmFunction(function, zoneServer, audioDrivers);
 }
コード例 #15
0
        public void ActiveTest6()
        {
            TimeSpan                       validFrom    = new TimeSpan(DateTime.Now.Hour - 1, 0, 0);
            TimeSpan                       validTo      = new TimeSpan(23, 59, 59);
            ZoneChangeFunction             function     = new ZoneChangeFunction(new SimpleId(), new Address(), new Address(), 0, null, validFrom, validTo, null);
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            bool actual;

            actual = target.Active;
            Assert.AreEqual(true, actual);
        }
コード例 #16
0
        /// <summary>
        /// Constructor to instantiate a concrete zone change function.
        /// </summary>
        /// <param name="function">Configuration data for this zone change function.</param>
        /// <param name="zoneServer">Zone server, to get notification about zone changes.</param>
        /// <param name="audioDrivers">Audio Drivers, in case a sound needs to be played.</param>
        public ConcreteOscEventFunction(OscEventFunction function, IZoneServer zoneServer, Dictionary <int, IAudioDriver> audioDrivers, Dictionary <int, IOscDriver> oscDrivers)
            : base(zoneServer, function, audioDrivers)
        {
            _oscDrivers = oscDrivers;

            if (function == null)
            {
                onFunctionError();
                throw new FunctionServerException("Function configuration is null. This is not allowed");
            }
            _function = function;
            _oscDrivers[_function.OscDevice.ObjectId].onOscEventReceived += new OscEventReceivedEventHandler(ConcreteOscFunction_onOscEventReceived);
        }
コード例 #17
0
        public void notifyOnZoneUpdateTest2()
        {
            List <Command> commands = new List <Command>();

            commands.Add(new SendNuvoCommand(new SimpleId(), true, true, true, true, true, true, true, new Address("100.1"), "OFF", "100.6", 10));
            ZoneChangeFunction             function     = new ZoneChangeFunction(new SimpleId(), new Address(), new Address(), 0, true, true, true, true, null, new TimeSpan(), new TimeSpan(), commands);
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            ZoneStateEventArgs             e            = new ZoneStateEventArgs(new ZoneState());
            // not supported anymore; quick-fix, uncomment unit test -> target.notifyOnZoneUpdate(e); // init zone state
            // not supported anymore; quick-fix, uncomment unit test -> target.notifyOnZoneUpdate(e);
        }
コード例 #18
0
        public void ActiveTest2()
        {
            List <DayOfWeek> dayOfWeek = new List <DayOfWeek>();

            dayOfWeek.Add(DateTime.Now.DayOfWeek);
            ZoneChangeFunction             function     = new ZoneChangeFunction(new SimpleId(), new Address(), new Address(), 0, dayOfWeek, null);
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            bool actual;

            actual = target.Active;
            Assert.AreEqual(true, actual);
        }
コード例 #19
0
        /// <summary>
        /// Public constructor.
        /// </summary>
        /// <param name="zoneServer">Zone server, to get/set zone state.</param>
        /// <param name="functions">Functions</param>
        public FunctionServer(IZoneServer zoneServer, List <Function> functions, Dictionary <int, IAudioDriver> audioDrivers, Dictionary <int, IOscDriver> oscDrivers)
        {
            _zoneServer   = zoneServer;
            _audioDrivers = audioDrivers;
            _oscDrivers   = oscDrivers;

            instantiateFunctions(functions);

            traceFunctions();

            _log.Trace(m => m("Function timer started, each {0}[s]", Properties.FunctionServer.Default.FunctionIntervall));
            _timerFunction.Interval = (Properties.FunctionServer.Default.FunctionIntervall < 10 ? 10 : Properties.FunctionServer.Default.FunctionIntervall) * 1000;
            _timerFunction.Elapsed += new System.Timers.ElapsedEventHandler(_timerFunction_Elapsed);
            _timerFunction.Start();
        }
コード例 #20
0
 public void ConcreteAlarmFunctionConstructorTest1()
 {
     try
     {
         AlarmFunction function   = null;
         IZoneServer   zoneServer = null;
         Dictionary <int, IAudioDriver> audioDrivers = null;
         ConcreteAlarmFunction          target       = new ConcreteAlarmFunction(function, zoneServer, audioDrivers);
     }
     catch (FunctionServerException)
     {
         return;
     }
     Assert.Fail("'FunctionServerException' Exception expected!");
 }
コード例 #21
0
 public void ConcreteSleepFunctionConstructorTest2()
 {
     try
     {
         SleepFunction function   = null;
         IZoneServer   zoneServer = null;
         Dictionary <int, IAudioDriver> audioDrivers = null;
         ConcreteSleepFunction          target       = new ConcreteSleepFunction(function, zoneServer, audioDrivers);
     }
     catch (FunctionServerException)
     {
         // ok, catch expection
         return;
     }
     Assert.Fail("Exception 'FunctionServerException' expected!");
 }
コード例 #22
0
        public void isFunctionActiveTodayTest1()
        {
            List <DayOfWeek> _dayOfWeeks = new List <DayOfWeek>();
            AlarmFunction    function    = new AlarmFunction(
                SimpleId.NewGuid(),
                new Address(100, 1), new Address(100, 1), 50,
                new TimeSpan(6, 0, 0), new TimeSpan(0, 45, 0),
                _dayOfWeeks);
            IZoneServer zoneServer = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteAlarmFunction          target       = new ConcreteAlarmFunction(function, zoneServer, audioDrivers);
            DateTime aktTime = DateTime.Now;
            bool     actual  = target.isFunctionActiveToday(aktTime);

            Assert.AreEqual(false, actual);
        }
コード例 #23
0
        /// <summary>
        /// Instantiates the zone server. This object holds all zone controllers.
        /// </summary>
        private static void InstantiateZoneServer()
        {
            LogHelper.Log(LogLevel.Info, String.Format(">>> Instantiating the zone server..."));

            List <IZoneController> zoneControllers = new List <IZoneController>();

            foreach (Device device in _configurationService.SystemConfiguration.Hardware.Devices)
            {
                foreach (Zone zone in device.ZoneList)
                {
                    zoneControllers.Add(new ZoneController(new Address(device.Id, zone.Id.ObjectId), _protocolDrivers[device.Id]));
                }
            }
            _zoneServer = new NuvoControl.Server.ZoneServer.ZoneServer(zoneControllers);
            _zoneServer.StartUp();
        }
コード例 #24
0
 public static IConcreteCommand instantiateConcreteCommand(Command command, IZoneServer zoneServer, Dictionary <int, IAudioDriver> audioDrivers)
 {
     if (typeof(SendMailCommand) == command.GetType())
     {
         return(new ConcreteSendMailCommand((SendMailCommand)command));
     }
     else if (typeof(PlaySoundCommand) == command.GetType())
     {
         PlaySoundCommand playSoundCommand = (PlaySoundCommand)command;
         return(new ConcretePlaySoundCommand(playSoundCommand, zoneServer, audioDrivers[playSoundCommand.SourceId.ObjectId]));
     }
     else if (typeof(SendNuvoCommand) == command.GetType())
     {
         return(new ConcreteSendNuvoCommand((SendNuvoCommand)command, zoneServer));
     }
     return(null);
 }
コード例 #25
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="zoneServer"></param>
        /// <param name="function"></param>
        public ConcreteFunction(IZoneServer zoneServer, Function function, Dictionary <int, IAudioDriver> audioDrivers)
        {
            if (function == null)
            {
                onFunctionError();
                throw new FunctionServerException("Function configuration is null. This is not allowed");
            }

            _zoneServer = zoneServer;
            if (_zoneServer == null)
            {
                _log.Warn(m => m("Zone Server not available, cannot monitor any zone ..."));
            }

            _audioDrivers = audioDrivers;
            _function     = function;

            instantiateConcreteCommands();
        }
コード例 #26
0
 public void calculateFunctionTest1()
 {
     try
     {
         SleepFunction function   = new SleepFunction();
         IZoneServer   zoneServer = null;
         Dictionary <int, IAudioDriver> audioDrivers = null;
         ConcreteSleepFunction          target       = new ConcreteSleepFunction(function, zoneServer, audioDrivers);
         //target.notifyOnZoneUpdate();
         DateTime aktTime = new DateTime();
         target.calculateFunction(aktTime);
     }
     catch (FunctionServerException)
     {
         // ok, catch expection
         return;
     }
     Assert.Fail("Exception 'FunctionServerException' expected!");
 }
コード例 #27
0
        public void ActiveTest4()
        {
            List <DayOfWeek> dayOfWeek = new List <DayOfWeek>();

            dayOfWeek.Add(DayOfWeek.Monday);
            dayOfWeek.Add(DayOfWeek.Tuesday);
            dayOfWeek.Add(DayOfWeek.Wednesday);
            dayOfWeek.Add(DayOfWeek.Thursday);
            dayOfWeek.Add(DayOfWeek.Friday);
            dayOfWeek.Add(DayOfWeek.Saturday);
            dayOfWeek.Add(DayOfWeek.Sunday);
            ZoneChangeFunction             function     = new ZoneChangeFunction(new SimpleId(), new Address(), new Address(), 0, dayOfWeek, null);
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            bool actual;

            actual = target.Active;
            Assert.AreEqual(true, actual);
        }
コード例 #28
0
        public void isFunctionActiveRightNowTest2()
        {
            SleepFunction function = new SleepFunction(SimpleId.NewGuid(), new Address(100, 1),
                                                       new TimeSpan(1, 0, 0), new TimeSpan(6, 0, 0), new TimeSpan(9, 0, 0));
            IZoneServer zoneServer = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteSleepFunction          target       = new ConcreteSleepFunction(function, zoneServer, audioDrivers);
            bool actual = false;

            // (a) Function is not active, current time is outside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 10, 0, 0));
            Assert.AreEqual(false, actual);

            // (b) Function is not active, current time is outside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 9, 0, 1));
            Assert.AreEqual(false, actual);

            // (c) Function is not active, current time is outside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 5, 59, 59));
            Assert.AreEqual(false, actual);

            // (d) Function is active, current time is inside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 6, 0, 10));
            Assert.AreEqual(true, actual);

            // (e) Function is active, current time is inside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 8, 59, 59));
            Assert.AreEqual(true, actual);

            // (f) Function is not active, current time is outside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 0, 0, 0));
            Assert.AreEqual(false, actual);

            // (g) Function is active, current time is inside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 6, 0, 0));
            Assert.AreEqual(true, actual);

            // (h) Function is active, current time is inside the validFrom/validTo range
            actual = target.isFunctionActiveRightNow(new DateTime(2000, 1, 1, 9, 0, 0));
            Assert.AreEqual(true, actual);
        }
コード例 #29
0
        public void ActiveTest9()
        {
            List <DayOfWeek> dayOfWeek = new List <DayOfWeek>();

            dayOfWeek.Add(DayOfWeek.Monday);
            dayOfWeek.Add(DayOfWeek.Tuesday);
            dayOfWeek.Add(DayOfWeek.Wednesday);
            dayOfWeek.Add(DayOfWeek.Thursday);
            dayOfWeek.Add(DayOfWeek.Friday);
            dayOfWeek.Add(DayOfWeek.Saturday);
            dayOfWeek.Add(DayOfWeek.Sunday);
            TimeSpan                       validFrom    = new TimeSpan(0, 0, 1); // NOTE: (0,0,0) is considered as "not set" (not used)
            TimeSpan                       validTo      = new TimeSpan(DateTime.Now.Hour - 1, 59, 59);
            ZoneChangeFunction             function     = new ZoneChangeFunction(new SimpleId(), new Address(), new Address(), 0, dayOfWeek, validFrom, validTo, null);
            IZoneServer                    zoneServer   = null;
            Dictionary <int, IAudioDriver> audioDrivers = null;
            ConcreteZoneChangeFunction     target       = new ConcreteZoneChangeFunction(function, zoneServer, audioDrivers);
            bool actual;

            actual = target.Active;
            Assert.AreEqual(false, actual);
        }
コード例 #30
0
 public ConcreteFunctionTestClass(Function function, IZoneServer zoneServer, Dictionary <int, IAudioDriver> audioDrivers) :
     base(zoneServer, function, audioDrivers)
 {
     _function = function;
     subscribeZone(_function.ZoneId);
 }