Пример #1
0
 public void firstp()
 {
     Default1Controller controller = new Default1Controller();
         var model = new Class1();
         model.text1 = "abc";
         string op = "b1";
         ViewResult result = controller.View1(model, op) as ViewResult;
         Assert.AreEqual(model.result, "correct input");
 }
Пример #2
0
 public void firstn()
 {
     Default1Controller controller = new Default1Controller();
         var model = new Class1();
         model.text1 = "234";
         string op = "b1";
         var result = controller.View1(model, op) as HttpStatusCodeResult;
       //  ViewResult result = controller.View1(model, op) as ViewResult;
         Assert.AreEqual(400, result.StatusCode);
 }
Пример #3
0
 public void fnull()
 {
     Default1Controller controller = new Default1Controller();
          var model = new Class1();
          model.text1 = null;
          string op = "b1";
          var result = controller.View1(model, op) as HttpNotFoundResult;
         // ViewResult result = controller.View1(model, op) as ViewResult;
       //   Assert.AreEqual(model.result, "");
          Assert.AreEqual(404, result.StatusCode);
 }
Пример #4
0
 public void thirdn()
 {
     Default1Controller controller = new Default1Controller();
         var model = new Class1();
         model.text3 = "fvvfdv";
         string op = "b3";
       //  ViewResult result = controller.View1(model, op) as ViewResult;
         //Assert.AreEqual(model.result, "only special characters allowed");
         var result = controller.View1(model, op) as HttpStatusCodeResult;
         //  ViewResult result = controller.View1(model, op) as ViewResult;
         Assert.AreEqual(400, result.StatusCode);
 }
Пример #5
0
        public void secondn()
        {
            Default1Controller controller = new Default1Controller();
                var model = new Class1();

                model.text2 = "abc";
                string op = "b2";
             //   ViewResult result = controller.View1(model, op) as ViewResult;
               // Assert.AreEqual(model.result, "only numeric characters allowed");
                var result = controller.View1(model, op) as HttpStatusCodeResult;
                //  ViewResult result = controller.View1(model, op) as ViewResult;
                Assert.AreEqual(400, result.StatusCode);
        }
Пример #6
0
 public void thirdp()
 {
     Default1Controller controller = new Default1Controller();
         var model = new Class1();
         model.text3 = "/;'[]";
         string op = "b3";
         ViewResult result = controller.View1(model, op) as ViewResult;
         Assert.AreEqual(model.result, "correct input");
 }