public void ExtendQueueCookie_Test() { // Arrange UserInQueueServiceMock mock = new UserInQueueServiceMock(); KnownUser._UserInQueueService = (mock); // Act KnownUser.ExtendQueueCookie("eventId", 20, "secretKey"); // Assert Assert.Equal("eventId", mock.extendQueueCookieCalls[0][0]); Assert.Equal("20", mock.extendQueueCookieCalls[0][1]); Assert.Equal("secretKey", mock.extendQueueCookieCalls[0][2]); }
public void ExtendQueueCookie_NullEventId_Test() { // Arrange UserInQueueServiceMock mock = new UserInQueueServiceMock(); KnownUser._UserInQueueService = (mock); bool exceptionWasThrown = false; // Act try { KnownUser.ExtendQueueCookie(null, 0, null); } catch (ArgumentException ex) { exceptionWasThrown = ex.Message == "eventId can not be null or empty."; } // Assert Assert.True(mock.extendQueueCookieCalls.Count == 0); Assert.True(exceptionWasThrown); }
public void ExtendQueueCookie_InvalidCookieValidityMinutes_Test() { // Arrange UserInQueueServiceMock mock = new UserInQueueServiceMock(); KnownUser._UserInQueueService = (mock); bool exceptionWasThrown = false; // Act try { KnownUser.ExtendQueueCookie("eventId", 0, null); } catch (ArgumentException ex) { exceptionWasThrown = ex.Message == "cookieValidityMinute should be greater than 0."; } // Assert Assert.True(mock.extendQueueCookieCalls.Count == 0); Assert.True(exceptionWasThrown); }