public GetState ( System.Guid id ) : Data.Enums.EventState | ||
id | System.Guid | The ID of the event to retrieve the state of |
Результат | Data.Enums.EventState |
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); }
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); }
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); }
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); }