Beispiel #1
0
        public void Inputandouputpathareinthecorrectformatandtestshouldbesuccess()
        {
            // Arrange
            var ctrl  = new CSVtojsonController();
            var model = new FilePathParam();

            model.uploadoutput = "@C:/Users/myfile.js";
            model.uploadinput  = "@C:/file.csv";
            var expected = "JsonFileSuccess";

            // Act
            var actionResult = ctrl.StartMyApp(model) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual("CSVtojson", actionResult.RouteValues["controller"]);
            Assert.AreEqual(expected, actionResult.RouteValues["action"]);
        }
Beispiel #2
0
        public void Inputandouputpathareinthecorrectformatandtestshouldfail()
        {
            // Arrange
            var ctrl  = new CSVtojsonController();
            var model = new FilePathParam();

            model.uploadoutput = "@C:/Users/myfile.js";
            model.uploadinput  = "@C:/file.txt";
            var expected = "StartMyApp";

            // Act
            var actionResult = ctrl.StartMyApp(model) as RedirectToRouteResult;

            System.Diagnostics.Debugger.Launch();
            // Assert
            Assert.AreEqual("CSVtojson", actionResult.RouteValues["controller"]);
            Assert.AreEqual(expected, actionResult.RouteValues["action"]);
        }