GetState() 공개 메소드

Retrieves the current state of the given event
public GetState ( System.Guid id ) : Data.Enums.EventState
id System.Guid The ID of the event to retrieve the state of
리턴 Data.Enums.EventState
예제 #1
0
        public void EventsService_GetState_WorldEvent_Blank_Inactive()
        {
            EventsService es = new EventsService();
            es.LoadTables(false);

            var sw = new Stopwatch();
            sw.Start();
            var state = es.GetState(new WorldBossEvent());
            sw.Stop();
            Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);

            Assert.AreEqual(EventState.Inactive, state);
        }
예제 #2
0
        public void EventsService_GetState_WorldEvent_Success_Inactive()
        {
            var timeMock = new Mock<ITimeProvider>();

            EventsService es = new EventsService(null, null, timeMock.Object);
            es.LoadTables(false);

            var validEvent = es.WorldBossEventTimeTable.WorldEvents[0];
            var activeTime = DateTimeOffset.UtcNow.Date.Add(validEvent.ActiveTimes[0].Time).AddMinutes(-10);
            timeMock.Setup(t => t.CurrentTime).Returns(activeTime);

            var sw = new Stopwatch();
            sw.Start();
            var state = es.GetState(validEvent);
            sw.Stop();
            Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);

            Assert.AreEqual(EventState.Inactive, state);
        }
예제 #3
0
        public void EventsService_GetState_WorldEvent_Null_Invalid()
        {
            EventsService es = new EventsService();
            es.LoadTables(false);

            var sw = new Stopwatch();
            sw.Start();
            var state = es.GetState(null);
            sw.Stop();
            Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);

            Assert.AreEqual(EventState.Unknown, state);
        }
예제 #4
0
        public void EventsService_GetState_Id_Success_Warmup()
        {
            var timeMock = new Mock<ITimeProvider>();

            EventsService es = new EventsService(null, timeMock.Object);
            es.LoadTable(true);

            var validEvent = es.EventTimeTable.WorldEvents[0];
            var activeTime = DateTimeOffset.UtcNow.Date.Add(validEvent.ActiveTimes[0].Time).AddMinutes((validEvent.WarmupDuration.Time.TotalMinutes * - 1) + 1);
            timeMock.Setup(t => t.CurrentTime).Returns(activeTime);

            var sw = new Stopwatch();
            sw.Start();
            var state = es.GetState(validEvent.ID);
            sw.Stop();
            Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);

            Assert.AreEqual(EventState.Warmup, state);
        }