Problem I was facing the following Exception when I was programmatically assigning Selected Value of a DropDownList with the following piece of code. ListItem item = DropDownListTest.Items.Find... if (item != null) item.Selected = true; Exception Cannot have multiple items selected in a DropDownList. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in ......
Filling up Mock objects with random data is possibly one of the most time consuming and boring chapter of writing test cases. Let say we have the following classes and we want to write some mock objects. Mock Object Code Example private Client GetMockClient() { Client Client1 = new Client(); Client1.FirstName = "Random String 6dc22d70-ad0c-4552-9c86-292... Client1.LastName = "Random String 3e08dc98-495a-4a70-bff4-b7b... ClientAddress ClientAddress2 = new ClientAddress(); ContactAddress ......