Testing the Application
The application is now ready for testing. Make sure that the Windows Phone emulator is selected as the debugging target device, and then press F5. In Figure 7, the app shows a list of orders that were previously added to the application data inside the LightSwitch client.
Figure 7 Displaying LightSwitch data inside the Windows Phone client.
You can also try to delete and add a new order with the appropriate buttons in the application.
The last test involves understanding how LightSwitch permissions work on the server side. In fact, you created a test user who has permissions for deleting entities and used this test user in your mobile client. But what happens if you pass credentials of a user who doesn't have those permissions? To understand how this works, follow these steps:
- In the constructor shown earlier (in Listing 4), replace the test user's credentials with the credentials of another user, such as the application administrator.
- Run the application and delete an entity.
- Try to save your changes.
At this point an exception is thrown, because the new user doesn't have permissions to delete entities. The LightSwitch logic therefore has been respected perfectly.