public void New_ReturnsCorrectView_True()
        {
            PalindromeController controller = new PalindromeController();
            ActionResult         indexView  = controller.New();

            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
        public PalindromeControllerTests()
        {
            datarepo = new FakePalindromeDataRepository();

            businessrepo = new PalindromeBusinessRepository(datarepo);

            controller = new PalindromeController(businessrepo);
        }
        public void Create_ReturnsCorrectView_True()
        {
            string phrase                   = "";
            bool   isPalindrome             = false;
            PalindromeController controller = new PalindromeController();
            ActionResult         indexView  = controller.Create(phrase, isPalindrome);

            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
        public void Create_HasCorrectModelType_Palindromes()
        {
            string phrase                   = "";
            bool   isPalindrome             = false;
            PalindromeController controller = new PalindromeController();
            ViewResult           createView = controller.Create(phrase, isPalindrome) as ViewResult;
            var result = createView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(Palindrome));
        }
예제 #5
0
        public async Task IsPalindrome_ReturnFalse()
        {
            var value      = "А наша роза упала на лапу Азора";
            var controller = new PalindromeController();

            var result = await controller.IsPalindrome(value) as OkNegotiatedContentResult <bool>;

            Assert.IsNotNull(result);
            Assert.IsFalse(result.Content);
        }
예제 #6
0
        public async Task IsPalindrome_ThreadLimit_BadRequest()
        {
            var value = "";
            PalindromeController controller;
            var threadCount = int.Parse(ConfigurationManager.AppSettings["ThreadCount"]);

            for (int i = 0; i < threadCount; i++)
            {
                ThreadPool.QueueUserWorkItem((o) =>
                {
                    controller = new PalindromeController();
                    controller.IsPalindrome(value);
                });
            }
            Thread.Sleep(100);
            controller = new PalindromeController();
            var result = await controller.IsPalindrome(value);

            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
        }