public void TestControllerMethodAttributes() { #if DEBUG var countAdjustment = 1; #else var countAdjustment = 0; #endif //1 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Index", 1 + countAdjustment, "Receipt-2", showListOfAttributes: true); }
public void TestControllerMethodAttributes() { #if DEBUG var countAdjustment = 1; #else var countAdjustment = 0; #endif //1 ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Receipt", 2, "Receipt-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <IgnoreAntiforgeryTokenAttribute>("Receipt", 2, "Receipt-2", showListOfAttributes: false); //2 ControllerReflection.MethodExpectedAttribute <IgnoreAntiforgeryTokenAttribute>("PaymentError", 1, "PaymentError", showListOfAttributes: false); //3 ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Cancel", 2, "Cancel-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <IgnoreAntiforgeryTokenAttribute>("Cancel", 2, "Cancel-2", showListOfAttributes: false); //4 ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("ProviderNotify", 4 + countAdjustment, "ProviderNotify-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("ProviderNotify", 4 + countAdjustment, "ProviderNotify-2", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <AllowAnonymousAttribute>("ProviderNotify", 4 + countAdjustment, "ProviderNotify-3", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <IgnoreAntiforgeryTokenAttribute>("ProviderNotify", 4 + countAdjustment, "ProviderNotify-4", showListOfAttributes: false); }
public void TestControllerMethodAttributes() { #if DEBUG var countAdjustment = 1; #else var countAdjustment = 0; #endif //1 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Link", 1 + countAdjustment, "Link-1", showListOfAttributes: false); //2 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Download", 1 + countAdjustment, "Download-1", showListOfAttributes: false); //3 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("ConfirmPayment", 2 + countAdjustment, "ConfirmPaymentGet-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpGetAttribute>("ConfirmPayment", 2 + countAdjustment, "ConfirmPaymentGet-1", showListOfAttributes: false); //4 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("ConfirmPayment", 2 + countAdjustment, "ConfirmPaymentPost-1", true, showListOfAttributes: true); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("ConfirmPayment", 2 + countAdjustment, "ConfirmPaymentPost-1", true, showListOfAttributes: false); //5 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Receipt", 1 + countAdjustment, "Receipt-1", showListOfAttributes: false); }
public void TestControllerMethodAttributes() { #if DEBUG var countAdjustment = 1; #else var countAdjustment = 0; #endif //1 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Index", 1 + countAdjustment, "Index-1", showListOfAttributes: false); //2 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Create", 1 + countAdjustment, "Create-1", showListOfAttributes: false); //3 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Edit", 1 + countAdjustment, "Edit-1", showListOfAttributes: false); //4 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Copy", 1 + countAdjustment, "Copy-1", showListOfAttributes: false); //5 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Save", 2 + countAdjustment, "Save-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Save", 2 + countAdjustment, "Save-2", showListOfAttributes: false); //6 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Details", 1 + countAdjustment, "Details-1", showListOfAttributes: false); //7 & 8 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Confirmation", 1 + countAdjustment, "CopyGet-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Confirmation", 2 + countAdjustment, "CopyPost-1", true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Confirmation", 2 + countAdjustment, "CopyPost-2", true, showListOfAttributes: false); //9 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Confirmed", 1 + countAdjustment, "Confirmed-1", showListOfAttributes: false); //10 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Delete", 2 + countAdjustment, "Delete-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Delete", 2 + countAdjustment, "Delete-2", showListOfAttributes: false); //11 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("LookupClientId", 2 + countAdjustment, "LookupClientId-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpGetAttribute>("LookupClientId", 2 + countAdjustment, "LookupClientId-2", showListOfAttributes: false); //12 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Favorites", 1 + countAdjustment, "Favorites-1", showListOfAttributes: false); //13 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("SaveLink", 2 + countAdjustment, "SaveLink-1", showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("SaveLink", 2 + countAdjustment, "SaveLink-1", showListOfAttributes: false); //14 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("DeleteLink", 2 + countAdjustment, "DeleteLink-1", showListOfAttributes: true); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("DeleteLink", 2 + countAdjustment, "DeleteLink-1", showListOfAttributes: false); }
public void TestControllerMethodAttributes() { #if DEBUG var countAdjustment = 1; #else var countAdjustment = 0; #endif //1 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Index", 1 + countAdjustment, "Index-1", showListOfAttributes: false); //2 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Details", 1 + countAdjustment, "Details-1", showListOfAttributes: false); //3 ControllerReflection.MethodExpectedNoAttribute("Create", "Create-1"); //4 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Create", 3 + countAdjustment, "Create-2", isSecondMethod: true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Create", 3 + countAdjustment, "Create-2", isSecondMethod: true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <ValidateAntiForgeryTokenAttribute>("Create", 3 + countAdjustment, "Create-2", isSecondMethod: true, showListOfAttributes: false); //It doesn't really need this because the class inherits the auto version //5 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Edit", 1 + countAdjustment, "Edit-1", showListOfAttributes: false); //6 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Edit", 3 + countAdjustment, "Edit-2", isSecondMethod: true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("Edit", 3 + countAdjustment, "Edit-2", isSecondMethod: true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <ValidateAntiForgeryTokenAttribute>("Edit", 3 + countAdjustment, "Edit-2", isSecondMethod: true, showListOfAttributes: false); //It doesn't really need this because the class inherits the auto version //7 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Delete", 1 + countAdjustment, "Delete-1", showListOfAttributes: false); //8 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("DeleteConfirmed", 4 + countAdjustment, "DeleteConfirmed-2", showListOfAttributes: true); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("DeleteConfirmed", 4 + countAdjustment, "DeleteConfirmed-2", showListOfAttributes: false); var result = ControllerReflection.MethodExpectedAttribute <ActionNameAttribute>("DeleteConfirmed", 4 + countAdjustment, "DeleteConfirmed-2", showListOfAttributes: false); result.Count().ShouldBe(1); result.ElementAt(0).Name.ShouldBe("Delete"); ControllerReflection.MethodExpectedAttribute <ValidateAntiForgeryTokenAttribute>("DeleteConfirmed", 4 + countAdjustment, "DeleteConfirmed-2", showListOfAttributes: false); //It doesn't really need this because the class inherits the auto version }
public void TestControllerMethodAttributes() { #if DEBUG var countAdjustment = 1; #else var countAdjustment = 0; #endif //1 var indexAuth = ControllerReflection.MethodExpectedAttribute <AuthorizeAttribute>("Index", 2 + countAdjustment, "Index-1", false, showListOfAttributes: false); indexAuth.ElementAt(0).Roles.ShouldBe(RoleCodes.Admin); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("Index", 2 + countAdjustment, "Index-1", false, showListOfAttributes: false); //2 var searchAdminUserAuth = ControllerReflection.MethodExpectedAttribute <AuthorizeAttribute>("SearchAdminUser", 3 + countAdjustment, "SearchAdminUser-1", false, showListOfAttributes: false); searchAdminUserAuth.ElementAt(0).Roles.ShouldBe(RoleCodes.Admin); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("SearchAdminUser", 3 + countAdjustment, "SearchAdminUser-2", false, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpGetAttribute>("SearchAdminUser", 3 + countAdjustment, "SearchAdminUser-3", false, showListOfAttributes: false); //3 var editAdminAminUserAuth = ControllerReflection.MethodExpectedAttribute <AuthorizeAttribute>("EditAdmin", 3 + countAdjustment, "EditAdmin-1", false, showListOfAttributes: false); editAdminAminUserAuth.ElementAt(0).Roles.ShouldBe(RoleCodes.Admin); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("SearchAdminUser", 3 + countAdjustment, "EditAdmin-2", false, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpGetAttribute>("EditAdmin", 3 + countAdjustment, "EditAdmin-3", false, showListOfAttributes: false); //4 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("ListClients", 1 + countAdjustment, "ListClients-1", false, showListOfAttributes: false); //5 & 6 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("EditUser", 1 + countAdjustment, "EditUserGet-1", false, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("EditUser", 2 + countAdjustment, "EditUserPost-1", true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("EditUser", 2 + countAdjustment, "EditUserPost-2", true, showListOfAttributes: false); //7 var addUserToRoleAuth = ControllerReflection.MethodExpectedAttribute <AuthorizeAttribute>("AddUserToRole", 3 + countAdjustment, "AddUserToRole-1", false, showListOfAttributes: false); addUserToRoleAuth.ElementAt(0).Roles.ShouldBe(RoleCodes.Admin); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("AddUserToRole", 3 + countAdjustment, "AddUserToRole-2", false, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("AddUserToRole", 3 + countAdjustment, "AddUserToRole-3", false, showListOfAttributes: false); //8 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("MailQueue", 1 + countAdjustment, "MailQueue-1", false, showListOfAttributes: false); //9 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("ViewMessage", 1 + countAdjustment, "ViewMessage-1", false, showListOfAttributes: false); //10 & 11 ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("FixEmail", 3 + countAdjustment, "FixEmailGet-1", false, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpGetAttribute>("FixEmail", 3 + countAdjustment, "FixEmailGet-2", false, showListOfAttributes: false); var fixEmailUserAuth = ControllerReflection.MethodExpectedAttribute <AuthorizeAttribute>("FixEmail", 3 + countAdjustment, "FixEmail-1", false, showListOfAttributes: false); fixEmailUserAuth.ElementAt(0).Roles.ShouldBe(RoleCodes.Admin); ControllerReflection.MethodExpectedAttribute <AsyncStateMachineAttribute>("FixEmail", 3 + countAdjustment, "FixEmailPost-1", true, showListOfAttributes: false); ControllerReflection.MethodExpectedAttribute <HttpPostAttribute>("FixEmail", 3 + countAdjustment, "FixEmailPost-2", true, showListOfAttributes: false); var fixEmailUserAuthPost = ControllerReflection.MethodExpectedAttribute <AuthorizeAttribute>("FixEmail", 3 + countAdjustment, "FixEmail-1", true, showListOfAttributes: false); fixEmailUserAuthPost.ElementAt(0).Roles.ShouldBe(RoleCodes.Admin); }