public void NotFoundCommand_Run_Sets404()
        {
            var command = new NotFoundCommand();
            var result = command.Run(Substitute.For<HttpRequestBase>());

            result.HttpStatusCode.Should().Be(HttpStatusCode.NotFound);
        }
Example #2
0
        public void GiberrishStringIsNotCommand()
        {
            var expected = new NotFoundCommand().GetType();
            var command  = parser.Parse("Hello world!");

            Assert.AreEqual(expected, command.GetType());
        }
Example #3
0
        public void ThreePiecesStringIsNotCommand()
        {
            var expected = new NotFoundCommand().GetType();
            var command  = parser.Parse("Look yourself now");

            Assert.AreEqual(expected, command.GetType());
        }
Example #4
0
        public void Length0StringIsNotCommand()
        {
            var expected = new NotFoundCommand().GetType();
            var command  = parser.Parse("");

            Assert.AreEqual(expected, command.GetType());
        }
Example #5
0
        public void EmptyStringIsNotCommand()
        {
            var expected = new NotFoundCommand().GetType();
            var command  = parser.Parse(string.Empty);

            Assert.AreEqual(expected, command.GetType());
        }
Example #6
0
        public void NotFoundCommand_Run_Sets404()
        {
            var command = new NotFoundCommand();
            var result  = command.Run(Substitute.For <HttpRequestBase>());

            result.HttpStatusCode.Should().Be(HttpStatusCode.NotFound);
        }
        public void NotFoundCommand_Run_Sets404()
        {
            var command = new NotFoundCommand();
            var result = command.Run(new HttpRequestData("GET", 
                new Uri("http://localhost/Saml2AuthenticationModule/NonExistingPath")));

            result.HttpStatusCode.Should().Be(HttpStatusCode.NotFound);
        }
        public void NotFoundCommand_Run_Sets404()
        {
            var command = new NotFoundCommand();
            var result  = command.Run(new HttpRequestData("GET",
                                                          new Uri("http://localhost/Saml2AuthenticationModule/NonExistingPath")));

            result.HttpStatusCode.Should().Be(HttpStatusCode.NotFound);
        }
Example #9
0
        public void NotFoundCommandsReturnsPlayState()
        {
            GameState expected = GameState.Play;

            var command = new NotFoundCommand();
            var actual  = command.Execute();

            Assert.AreEqual(expected, actual);
        }
Example #10
0
        /// <summary>
        ///     Проверяет, существует ли команда в списке доступных.
        ///     Если существует - возвращает команду.
        ///     Если не существует - возвращает команду <see cref="NotFoundCommand" />
        ///     Работает с командами, реализующими интерфейс <see cref="ICommand" />
        /// </summary>
        /// <param name="command">Название команды</param>
        /// <returns>Команда реализующая интерфейс <see cref="ICommand" /></returns>
        private ICommand CheckCommand(string command)
        {
            if (CommandMap.ContainsKey(command))
            {
                return(CommandMap[command]);
            }
            var notFound = new NotFoundCommand(this)
            {
                Name = command
            };

            return(notFound);
        }