Index client and server validation testing and, SYMBOLS 77–80 $(document).read(), jQuery, 143 composing messages, 170–171 handling validation of data layer repository, A 94–96 abstraction, of data layer, 93–94 InMemoryContactService and, 121–122 acceptable verbs, 38 usage tracking and, 241–242, 246, 248 [AcceptVerbs] attribute validation testing and, 80 overview of, 38 advice, AOP, 13 testing existence of Register action and AJAX correct signature, 39–40 displaying images after upload, 206 Accordion UI control, 251 message templating and, 219–220, 224 account management, high-level design POST vs. GET, 258 for, 29–30 submitting form data with, 201–204 AccountController class Alert boxes, 196 creating tests related to membership Amazon EC2 (Elastic Computer Cloud), actions, 37 260 testing user registration, 41–42 AOP (aspect-oriented programming), AccountControllerTest class, 39 12–13 action fi lters, ASP.NET MVC, 9 AppHelper class Action method creating for membership test, 46–48 image hosting, 208 testing validity for contact import, message composition, 173 155–156 message retrieval, 180–181 AppHelperTest class ActionFilterAttribute, creating action creating for membership test, 46 fi lters, 9 validating email address for registration, ActionResult, testingCOPYRIGHTED validity of, 37 MATERIAL45–47 ActiveX, 187 .ascx user controls, 132–134 Add method aspect, AOP, 13 adding messages to repository, 171 aspect-oriented programming (AOP), assigning unique ID, 97–98 12–13 447628bindex.indd7628bindex.indd 226363 88/4/09/4/09 99:34:06:34:06 AAMM ASP.NET MVC framework ASP.NET MVC framework, overview, 6–10 BlackTie theme, ThemeRoller, 255 action fi lters, 9 Browse actions/methods controller, 7–8 browsing messages, 179–180 HTML helpers, 9 contact management and, 129 model, 7–8 IContactService interface, 127 ModelState, 10 message composition and, 178 overview of, 6 redirection to following import, 149 routing, 8 sorting and, 134 TempData, 9–10 browsing contacts view, 7–8 adding pager as user control, 132–134 ViewData, 8–9 controller action for, 127 WebForms model vs., 6–7 design, 111 AssertCreateValidationError helper mapping URL to Contact controller, 129 function, for asserting validation overview of, 125 error, 169 PagedList class and, 127–129 assertions populating repository with test data, refactoring code and, 67–72 126–127 refactoring design and, 66 sorting and, 134–136 similarities pointing to need for refactoring, testing contract retrieval for logged-in user, 72 129–130 Assert.Throws, in exception testing, 79 testing retrieval of one page of contacts, attributes, validation, 84 126 authentication, forms, 54–55 view for iterating through contact list, Authorize action fi lter, 9 130–132 Authorize attribute, 168 bugs Autofac, IoC container, 21 creating contacts and, 121, 125 importing contacts and, 161–165 B refactoring not fi xing, 259 TDD (Test Driven Development) and, 11 banners, as images, 195 business logic object, 77 billing and subscriptions buttons constructing payment service, 226–228 creating for PayPal, 234 design, 225–226 CSS interaction state classes applied overview of, 225 to, 256 PayPal implementation, 228–230 as images, 195 problem statement, 225 Insert Image button, 196–198 summary, 236 View of, 233–236 264 447628bindex.indd7628bindex.indd 226464 88/4/09/4/09 99:34:06:34:06 AAMM contact management populating repository with messages, C 179–180 caching problem statement, 167 images, 257–258 Request Validation and, 185 output caching, 258 returning error message if requested callbacks message does not exist, 181–182 payment processing and, 225 saving changes to repository, 183 verifying performance by callback method, summary, 185–186 226–228 testing if user can see messages, 182 campaign report, reports and stats testing that message is added to repository, design, 5 171–172 Cascading Style Sheets (CSS) validating message name, 168–169 in jQuery UI Library, 252–256 views of, 172–173, 178–179, 183–184 minifi cation of, 257 compression, gzip for, 257 classes constructor parameters, dependency ASP.NET MVC model, 7 injection and, 103, 106–107 defi ning user class, 122 Contact Lists, 110 click events, images, 209 contact management client-side validation, 87–92 browsing contacts. See browsing contacts benefi ts of, 73 checking validity of contact information options for, 87–88 (email, date of birth), 114–116 test class for, 88–92 contact defi ned, 111 validating contact view, 115–116 controller for, 112–113 cloud computing, 260 Create action, 113–114, 119 code coverage, 19–20 creating contacts, 111 code refactoring. See refactoring code deleting contacts, 111, 143–144 ComplexModelBinder, 69 design, 110–111 composing messages editing contacts. See editing contacts adding instance of IMessageService, 170 establishing relationship between user and Authorize attribute for controlling access contact, 121–122 to message creation, 168 high-level design for, 32–33 coding edit functionality, 180–181 importing contacts. See importing contacts creating message controller, 168 instantiating controller using dependency design process, 167 injection, 123–125 helper methods for populating repository, notifi cation of successful creation of 176–177 contact, 119–120 listing existing messages, 174–175 overview of, 3–5, 109 overview of, 167 265 447628bindex.indd7628bindex.indd 226565 88/4/09/4/09 99:34:06:34:06 AAMM contact management (continued) contact management (continued) controls, in jQuery UI Library, 251 problem statement, 109–110 Convention over Confi guration principle, summary, 145 17–18 testing contact creation, 116–118 copying/pasting contacts, 147 testing invalid email, 118 coupling, benefi ts of loosely coupled testing that multiple users can access systems, 103 same contact, 123 Create action/methods testing uniqueness of email addresses, action fi lters, 9 120–121 contact management, 113–114 TinyMCE integration with contact contacts, 3–4 management systems, 188 CRUD operations, 31 ContactController message controller, 168 creating contacts and, 112–113 messages, 2, 31, 76 importing contacts and, 148 preventing unauthorized access to, 168 ContactServiceTests class, 159 CreateUser method containers, IoC. See IoC (Inversion handling registration failures from of Control) Membership Provider, 49–50 controllers simulating call to membership AccountController class, 37, 39, 41–42 provider, 40–42 ASP.NET MVC, 7–8 creating contacts Browse controller action, 127–130 checking validity of contact information confi guring for dependency injection, 106 (email, date of birth), 114–116 contact editing, 137 controller for, 112–113 contact management, 112–113 Create action, 113–114, 119 ContactController class, 148 design, 111 creating message controller, 168 establishing relationship between user and GalleryController class, 199–200 contact, 121–122 helper method for instantiating, 177 instantiating controller using dependency IoC (Inversion of Control), 123–124 injection, 123–125 MessageController class, 75, 77, notifi cation of successful contact 84–85, 170 creation, 119–120 PayController controller, 226 testing contact creation, 116–118 refactoring controller actions, 65 testing invalid email, 118 SetUp method and, 176 testing that multiple users can access template controllers, 213–214 same contact, 123 TrackerController controller, 239, 241 testing uniqueness of email usage tracking, 238–241 addresses, 120–121 266 447628bindex.indd7628bindex.indd 226666 88/4/09/4/09 99:34:06:34:06 AAMM edit actions cross-cutting concerns, AOP, 12 design, high-level CRUD (create, read, update, and delete) account management, 29–30 contact management using, 31 contact management, 32–33 IRespository pattern and, 94 environment requirements, 34 CSS (Cascading Style Sheets) membership system, 25–29 in jQuery UI Library, 252–256 message management, 31 minifi cation of, 257 overview of, 25 problem, 25 D DI (Dependency Injection) design, 104–105 data layer message templating and, 216 changing InMemoryMessageService to use Ninject IoC Containers for, 105–108 repository, 95–96 overview of, 103 creating IMessageRepository, 94–95 PayPal service, 235 design, 94 principle, 16 implementing IMessageRepository, 96, problem statement, 103–104 100–101 summary, 108 in-memory repository and, 102 overview of, 93 div element problem statement, 93 for hidden layers, 197 testing ability to save existing messages to holding images in, 207 repository, 99–100 document object model (DOM), 143 testing delete functionality, 98–99 DOM (document object model), 143 testing unique ID assignment, 97–98 DRY (don't repeat yourself) data store. See repositories principle, 16 databases. See repositories refactoring code and, 65 Date Picker, UI control, 251 duplicate action, messages, 3 delete actions DynamicImage action contact list, 5 testing fi le content and fi lename, 239–241 contact management, 111, 143–144 tracking email message view, 244 contacts, 4 CRUD operations, 31 E message repository, 98–99 EC2 (Elastic Computer Cloud), 260 messages, 3 edge cases, fi nding/handling, 186 Delete method, verifying removal of edit actions messages, 98–99 contacts, 4, 137 dependencies, 103. See also DI form submission, 140 (Dependency Injection) messages, 2, 182–183 Dependency Injection. See DI (Dependency post, 183 Injection) routing and, 8 267 447628bindex.indd7628bindex.indd 226767 88/4/09/4/09 99:34:06:34:06 AAMM Edit functionality Edit functionality, coding, 180 ErrorCodeToString method, 51–52 Edit link, creating, 174 EvenContact web application editing contacts defi ned, 1 adding error message for
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages23 Page
-
File Size-