Beispiel #1
0
        public void AddChannelInEventExecutor()
        {
            AMSEventSqlAdapter.Instance.ClearAll();
            AMSChannelSqlAdapter.Instance.ClearAll();

            AMSChannel channel = DataHelper.PrepareChannelData();

            AMSChannelSqlAdapter.Instance.Update(channel);

            AMSEvent eventData = DataHelper.PrepareEventData(channel.ID);

            AMSEventSqlAdapter.Instance.Update(eventData);

            AMSChannel newChannel = DataHelper.PrepareChannelData();

            AMSChannelSqlAdapter.Instance.Update(newChannel);

            AMSAddChannelInEventExecutor executor = new AMSAddChannelInEventExecutor(eventData.ID, newChannel.ID);

            executor.Execute();

            AMSChannelCollection channels = AMSEventSqlAdapter.Instance.LoadRelativeChannels(eventData.ID);

            channels.Output();
            Assert.AreEqual(2, channels.Count);
        }
Beispiel #2
0
        public void IncludeCompletedAndNeedStartEventsLoadNeedStopChannels()
        {
            AMSEventSqlAdapter.Instance.ClearAll();
            AMSChannelSqlAdapter.Instance.ClearAll();

            AMSChannel channel = DataHelper.PrepareChannelData();

            AMSChannelSqlAdapter.Instance.Update(channel);

            AMSEvent prevEventData = DataHelper.PrepareEventData(channel.ID);

            prevEventData.StartTime = DateTime.Now.AddHours(-2);
            prevEventData.EndTime   = DateTime.Now.AddHours(-1);

            AMSEventSqlAdapter.Instance.Update(prevEventData);

            AMSEvent nextEventData = DataHelper.PrepareEventData(channel.ID);

            nextEventData.StartTime = DateTime.Now.AddMinutes(30);
            nextEventData.EndTime   = DateTime.Now.AddHours(3);

            AMSEventSqlAdapter.Instance.Update(prevEventData);

            AMSChannelCollection needToStopChannels = AMSChannelSqlAdapter.Instance.LoadNeedStopChannels(TimeSpan.FromHours(1));

            needToStopChannels.Output();
            Assert.AreEqual(1, needToStopChannels.Count);
        }