GetTimeSinceActive() public method

Retrieves the amount of time since the last active time for the given event, using the megaserver timetables
public GetTimeSinceActive ( WorldBossEvent evt ) : System.TimeSpan
evt GW2PAO.API.Data.Entities.WorldBossEvent The event to retrieve the time for
return System.TimeSpan
コード例 #1
0
ファイル: EventsServiceTests.cs プロジェクト: SamHurne/gw2pao
        public void EventsService_GetState_GetTimeSinceActive_Null_Invalid()
        {
            EventsService es = new EventsService();

            var timeUntilActive = es.GetTimeSinceActive(null);

            Assert.AreEqual(TimeSpan.MinValue, timeUntilActive);
        }
コード例 #2
0
ファイル: EventsServiceTests.cs プロジェクト: SamHurne/gw2pao
        public void EventsService_GetState_GetTimeSinceActive_Blank_Invalid()
        {
            EventsService es = new EventsService();

            var timeUntilActive = es.GetTimeSinceActive(new WorldBossEvent());

            Assert.AreEqual(TimeSpan.MinValue, timeUntilActive);
        }
コード例 #3
0
ファイル: EventsServiceTests.cs プロジェクト: SamHurne/gw2pao
        public void EventsService_GetState_GetTimeSinceActive_Success_RollOver()
        {
            var testEvent = new WorldBossEvent();
            testEvent.ActiveTimes.Add(new SerializableTimespan(1, 0, 0));

            var timeMock = new Mock<ITimeProvider>();
            timeMock.Setup(t => t.CurrentTime).Returns(new DateTimeOffset(new DateTime(2014, 10, 22, 23, 0, 0)));
            EventsService es = new EventsService(null, null, timeMock.Object);

            var timeUntilActive = es.GetTimeSinceActive(testEvent);

            Assert.AreEqual(new TimeSpan(22, 0, 0), timeUntilActive);
        }