Beispiel #1
0
        public void TestFluentMap()
        {
            PostDataModel postData = null;

            routes.ShouldMap("/frombody/post/123").
            To <FromBodyController>(c => c.Post(123, postData));
        }
 public void FluentBindingTest()
 {
     routes.ShouldMap("/withobject/index/1/fred")
     .To <WithObjectController>(x => x.Index(new InputModel {
         Id = 1, Name = "fred"
     }));
 }
 public void IndexShouldThrowExceptionWhenControllersDoNotMatch()
 {
     Assert.Throws(
         typeof(MvcRouteTester.Assertions.AssertionException),
         () => routeCollection
         .ShouldMap(ValidUrl)
         .To <MatchesController>(x => x.Index()));
 }
        public void ArticlesRoute_WithHttpMethod_Get_RouteWith_Controller_Get_Action_Id_ShouldMap()
        {
            testRoutes.ShouldMap("/AllArticles/1")
            .To <ArticlesController>(c => c.Index(string.Empty));

            testRoutes.ShouldMap("/AllArticles/1")
            .To <ArticlesController>(HttpMethod.Get, c => c.Index(string.Empty));
        }
Beispiel #5
0
        public void HomeHasRoutes()
        {
            RouteCollection routes = new RouteCollection();
            RouteConfig.RegisterRoutes(routes);

            routes.ShouldMap("~/").To<WKeeper.WebUI.Controllers.HomeController>(x => x.Index());
            routes.ShouldMap("~/Home/Index").To<WKeeper.WebUI.Controllers.HomeController>(x => x.Index());
            routes.ShouldMap("/").From<WKeeper.WebUI.Controllers.HomeController>(x => x.Index());
        }
Beispiel #6
0
        public void AreaCatalogsHasRoutes()
        {
            RouteCollection routes = new RouteCollection();

            var areaRegistration = new CatalogsAreaRegistration();
            AreaRegistrationContext context = new AreaRegistrationContext(areaRegistration.AreaName, routes);
            areaRegistration.RegisterArea(context);

            RouteConfig.RegisterRoutes(routes);

            // INCOMING ROUTES
            routes.ShouldMap("~/Catalogs").To<WKeeper.WebUI.Areas.Catalogs.Controllers.HomeController>(x => x.Index());
            routes.ShouldMap("~/Catalogs/Home/Index").To<WKeeper.WebUI.Areas.Catalogs.Controllers.HomeController>(x => x.Index());

            routes.ShouldMap("~/Catalogs/Colors").To<ColorsController>(x => x.Index());
            routes.ShouldMap("~/Catalogs/Colors/Index").To<ColorsController>(x => x.Index());

            routes.ShouldMap("~/Catalogs/Materials").To<MaterialsController>(x => x.Index());
            routes.ShouldMap("~/Catalogs/Materials/Index").To<MaterialsController>(x => x.Index());

            // OUTGOING ROUTES
            routes.ShouldMap("/Catalogs").From<WKeeper.WebUI.Areas.Catalogs.Controllers.HomeController>(x => x.Index());

            routes.ShouldMap("/Catalogs/Colors").From<ColorsController>(x => x.Index());

            routes.ShouldMap("/Catalogs/Materials").From<MaterialsController>(x => x.Index());
        }
Beispiel #7
0
        public void Urls()
        {
            var routes = new RouteCollection();

            RouteConfig.RegisterRoutes(routes);

            routes.ShouldMap("/home/index").To <HomeController>(x => x.Index());

            routes.ShouldMap("/images/green").To <ImagesController>(x => x.Index("green"));
            routes.ShouldMap("/images/green/1").To <ImagesController>(x => x.Index("green", 1));
        }
        public void ImagesRoute_RouteWith_Controller_Index_Action_Type_Id_ShouldMapToRenderOriginal()
        {
            testRoutes.ShouldMap("/Images/Original/type/1")
            .To <ImagesController>(c => c.RenderOriginal(string.Empty, string.Empty));

            testRoutes.ShouldMap("/Images/Original/type/1")
            .To <ImagesController>(HttpMethod.Get, c => c.RenderOriginal(string.Empty, string.Empty));

            testRoutes.ShouldMap("/Images/Original/type/1")
            .To <ImagesController>(HttpMethod.Post, c => c.RenderOriginal(string.Empty, string.Empty));
        }
Beispiel #9
0
        public void AreaDocumentsHasRoutes()
        {
            RouteCollection routes = new RouteCollection();

            var areaRegistration = new DocumentsAreaRegistration();
            AreaRegistrationContext context = new AreaRegistrationContext(areaRegistration.AreaName, routes);
            areaRegistration.RegisterArea(context);

            RouteConfig.RegisterRoutes(routes);

            routes.ShouldMap("~/Documents").To<WKeeper.WebUI.Areas.Documents.Controllers.IncomesController>(x => x.Index());
            routes.ShouldMap("~/Documents/Incomes/Index").To<WKeeper.WebUI.Areas.Documents.Controllers.IncomesController>(x => x.Index());
            routes.ShouldMap("~/Documents/Incomes/Edit/1").To<WKeeper.WebUI.Areas.Documents.Controllers.IncomesController>(x => x.Edit(1));
            routes.ShouldMap("~/Documents/Incomes/Delete/1").To<WKeeper.WebUI.Areas.Documents.Controllers.IncomesController>(x => x.Delete(1));
        }
Beispiel #10
0
 public void TestRouteEdit()
 {
     const string Url = "/Edit/EditTrip/1";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<EditController>(c => c.EditTrip(1));
 }
 public void TestHome()
 {
     const string Url = "/";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<HomeController>(c => c.Index());
 }
Beispiel #12
0
 public void TestRouteTripsListWithGivenFromAndТоLocations()
 {
     const string Url = "/TripsList?from=Балчик&to=Балчик&datepicker=&page=1";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<TripsListController>(c => c.Index(1, "Балчик", "Балчик", string.Empty));
 }
Beispiel #13
0
 public void TestRouteTrips()
 {
     const string Url = "/Trips/Index";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<TripsController>(c => c.Index());
 }
Beispiel #14
0
 public void TestRouteTripsListDefault()
 {
     const string Url = "/Trips";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<TripsListController>(c => c.Index(1, string.Empty, string.Empty, string.Empty));
 }
 public void TestAccountRegister()
 {
     const string Url = "/Account/Register";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<AccountController>(c => c.Register());
 }
Beispiel #16
0
 public void TestRouteLocations()
 {
     const string Url = "/Locations/GetAllLocations";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<LocationsController>(c => c.GetAllLocations());
 }
Beispiel #17
0
 public void TestRouteById()
 {
     const string Url = "/Trip/MTUuMTIzMTIzMTMxMjM===";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<TripsController>(c => c.ById("MTUuMTIzMTIzMTMxMjM==="));
 }
 public void IndexTest()
 {
     string url = "/Order/List";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<ListOrdersController>(c => c.Pending(null));
 }
 public void TestMainPage()
 {
     string url = "Administration/Administration/Index";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<AdministrationController>(c => c.Index());
 }
 public void TestEditCategoriesById()
 {
     string url = "Administration/Categories/Edit/6";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<CategoriesController>(c => c.Edit(6));
 }
 public void TestMyMessages()
 {
     const string Url = "/Messages/All/84cf88c3-9259-4003-ae42-a883be3bd67b";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<MessagesController>(c => c.All("84cf88c3-9259-4003-ae42-a883be3bd67b"));
 }
        public void TestRouteSuppliersGetPartners()
        {
            const string Url    = "/byCategories/222";
            var          routes = new RouteCollection();

            // Get my AreaRegistration class
            var areaRegistration = new UserAreaRegistration();

            Assert.AreEqual("Private", areaRegistration.AreaName);

            // Get an AreaRegistrationContext for my class. Give it an empty RouteCollection
            var areaRegistrationContext = new AreaRegistrationContext(areaRegistration.AreaName, routes);

            areaRegistration.RegisterArea(areaRegistrationContext);

            // Mock up an HttpContext object with my test path (using Moq)
            var context = new Mock <HttpContextBase>();

            context.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath).Returns("~/Private");

            // Get the RouteData based on the HttpContext
            var routeData = routes.GetRouteData(context.Object);

            routes.ShouldMap(Url).To <SuppliersController>(c => c.GetPartners(222));
        }
        public void HomeControllerShouldMap()
        {
            var routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap("/home").To <HomeController>(m => m.Index());
        }
 public void DefaultRouteToViewOrderTest()
 {
     string url = "/Order/View/Details/5";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<ViewOrderController>(c => c.Details(5));
 }
 public void CustomerOrderViewTest()
 {
     string url = "/Order/View/AfterCreation/5";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<ViewOrderController>(c => c.AfterCreation(5));
 }
 public void CommonOrderViewTest()
 {
     string url = "/Order/View/CommonDetails/5";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<ViewOrderController>(c => c.CommonDetails(5));
 }
Beispiel #27
0
 public void TestRouteById()
 {
     const string Url = "/Beer/Details/MS4xMjMxMjMxMzEyMw==";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<BeerController>(c => c.Details("MS4xMjMxMjMxMzEyMw=="));
 }
Beispiel #28
0
        public void RouteTest_DefaultRoute()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/").To <RootController>(x => x.Index());
        }
 public void TestRouteByPageAndPageSize()
 {
     const string Url = "/Tracks?page=1&pageSize=5";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<TracksController>(c => c.Index(1, 5));
 }
 public void MediaRouteDetailsShouldWorkCorrectly()
 {
     string Url = string.Format("/Media/Image/{0}/{1}/{2}", username, guid, size);
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<ImageController>(c => c.Index(username, guid, size));
 }
Beispiel #31
0
        public void RouteTest_Error404()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/Error/Error404").To <ErrorController>(x => x.Error404());
        }
Beispiel #32
0
        public void RouteTest_AdminTournamentJudges()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/Admin/Tournament/14/JudgeList").To <TournamentAdminController>(x => x.JudgeList(14));
        }
Beispiel #33
0
        public void RouteTest_AdminMain()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/Admin/Main").To <MainController>(x => x.Index());
        }
Beispiel #34
0
        public void RouteTest_AdminTournamentDefaultPageNew()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/Admin/Tournament/14").To <TournamentAdminController>(x => x.AdminIndex(14));
        }
 public void OutOrdersTestRouteCreate()
 {
     var routeCollection = new RouteCollection();
     const string Url = "/OutOrders/Create";
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<OutOrdersController>(c => c.Create());
 }
 public void OutOrdersTestRouteDetails()
 {
     var routeCollection = new RouteCollection();
     const string Url = "/OutOrders/Details/1";
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<OutOrdersController>(c => c.Details(1));
 }
Beispiel #37
0
        public void RouteTest_JudgeIndex()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/Judge/Tournament/1").To <TournamentJudgeController>(x => x.JudgeIndex(1, null));
        }
Beispiel #38
0
        public void RouteTest_Elmah_NoRoute()
        {
            var routes = new RouteCollection();

            RouteRegistrar.RegisterAll(routes);
            routes.ShouldMap("~/elmah.axd").ToIgnoredRoute();
        }
 public void RepairsTestRouteEdit()
 {
     var routeCollection = new RouteCollection();
     const string Url = "/Repairs/Edit/1";
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<RepairsController>(c => c.Edit(1));
 }
 public void TestRouteById()
 {
     const string Url = "/Joke/Mjc2NS4xMjMxMjMxMzEyMw==";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<ArticlesController>(c => c.ById("Mjc2NS4xMjMxMjMxMzEyMw=="));
 }
 public void AddOrderShouldBeOk()
 {
     string url = "/Order/Create/Add/";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<CreateOrderController>(c => c.Add(null));
 }
 public void CreateOrderShouldRouteCorrectly()
 {
     string url = "/Order/Create";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<CreateOrderController>(c => c.Index());
 }
        public void TestFluentRouteMismatch()
        {
            routes.ShouldMap("/hoomattr/mindex").To <HomeAttrController>(x => x.Index());

            Assert.That(assertEngine.FailCount, Is.GreaterThan(0));
            Assert.That(assertEngine.Messages[0], Is.EqualTo("Should have found the route to '/hoomattr/mindex'"));
        }
 public void PageRouteByIdShouldWorkCorrectlyWithoutSlug()
 {
     string Url = string.Format("/Page/{0}", pageId);
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<PageController>(c => c.Index(pageId));
 }
 public void TripRouteDetailsShouldWorkCorrectlyWithoutSlug()
 {
     string Url = string.Format("/Trip/{0}", pageId);
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(Url).To<TripController>(c => c.Details(pageId));
 }
 public void GridOrderTest()
 {
     string url = "/Order/Grid";
     var routeCollection = new RouteCollection();
     RouteConfig.RegisterRoutes(routeCollection);
     routeCollection.ShouldMap(url).To<OrdersGridController>(c => c.Index());
 }
        public void TestRouteById()
        {
            const string Url             = "/Home/Index";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap(Url).To <HomeController>(c => c.Index());
        }
Beispiel #48
0
        public void TestRouteById()
        {
            const string Url             = "/Beer/Details/MS4xMjMxMjMxMzEyMw==";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap(Url).To <BeerController>(c => c.Details("MS4xMjMxMjMxMzEyMw=="));
        }
Beispiel #49
0
        public void CallProperController()
        {
            const string url             = "/";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap(url).To <HomeController>(x => x.Index());
        }
Beispiel #50
0
        public void TestRouteByID()
        {
            var          routeCollection = new RouteCollection();
            const string url             = "/Book/MTQuMzQyMzM0MjM0";

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap(url).To <BooksController>(c => c.ById("MTQuMzQyMzM0MjM0", 1));
        }
Beispiel #51
0
        public void TestRouteByPageAndPageSize()
        {
            const string Url             = "/Tracks?page=1&pageSize=5";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap(Url).To <TracksController>(c => c.Index(1, 5));
        }
Beispiel #52
0
        public void TestRouteById()
        {
            const string Url             = "/Joke/Mjc2NS4xMjMxMjMxMzEyMw==";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection.ShouldMap(Url).To <JokesController>(c => c.ById("Mjc2NS4xMjMxMjMxMzEyMw=="));
        }
Beispiel #53
0
        public void TestRouteEditOnce()
        {
            const string Url             = "/ClassEvent/EditOnce/1";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);

            routeCollection.ShouldMap(Url).To <ClassEventController>(c => c.EditOnce(1));
        }
        public void RegisterOrganizationRouteTest()
        {
            const string Url             = "/Account/Register/Organization";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection
            .ShouldMap(HttpMethod.Get, Url)
            .To <AccountController>(c => c.Register());
        }
Beispiel #55
0
        public void PageNotFoundRouteTest()
        {
            const string Url             = "/Error/PageNotFound";
            var          routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);
            routeCollection
            .ShouldMap(Url)
            .To <ErrorController>(c => c.PageNotFound());
        }
        public void ShouldMapDocumentsControllerGetFile()
        {
            var routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);

            routeCollection
            .ShouldMap(HttpMethod.Get, "~/Documents/GetFile?documentId=1")
            .To <QMS.Web.Controllers.DocumentsController>(c => c.GetFile(1));
        }
        public void ShouldMapDocumentsControllerControllerIndexWithtProcedureId()
        {
            var routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);

            routeCollection
            .ShouldMap(HttpMethod.Get, "~/Documents/Index?procedureId=5")
            .To <QMS.Web.Controllers.DocumentsController>(c => c.Index(5));
        }
        public void ShouldMapDivisionsControllerIndex()
        {
            var routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);

            routeCollection
            .ShouldMap(HttpMethod.Get, "~/Divisions/Index")
            .To <QMS.Web.Controllers.DivisionsController>(c => c.Index());
        }
        public void ShouldMapCompanyAreasControllerIndexWithDepartmentId()
        {
            var routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);

            routeCollection
            .ShouldMap(HttpMethod.Get, "~/CompanyAreas/Index/1")
            .To <QMS.Web.Controllers.CompanyAreasController>(c => c.Index(null));
        }
        public void ShouldMapUsersControllerDetails()
        {
            var routeCollection = new RouteCollection();

            RouteConfig.RegisterRoutes(routeCollection);

            routeCollection
            .ShouldMap(HttpMethod.Get, "~/Users/Details")
            .To <QMS.Web.Controllers.UsersController>(c => c.Details(Guid.NewGuid().ToString()));
        }