コード例 #1
0
        public void CancelQueueCookie_Test()
        {
            // Arrange
            UserInQueueServiceMock mock = new UserInQueueServiceMock();

            KnownUser._UserInQueueService = (mock);

            // Act
            KnownUser.CancelQueueCookie("eventId");

            // Assert
            Assert.Equal("eventId", mock.cancelQueueCookieCalls[0][0]);
        }
コード例 #2
0
        public void CancelQueueCookie_NullEventId_Test()
        {
            // Arrange
            UserInQueueServiceMock mock = new UserInQueueServiceMock();

            KnownUser._UserInQueueService = (mock);
            bool exceptionWasThrown = false;

            // Act
            try
            {
                KnownUser.CancelQueueCookie(null);
            }
            catch (ArgumentException ex)
            {
                exceptionWasThrown = ex.Message == "eventId can not be null or empty.";
            }

            // Assert
            Assert.True(mock.cancelQueueCookieCalls.Count == 0);
            Assert.True(exceptionWasThrown);
        }