Reference no: EM133577489
Windows Programming
Assignment:
a) Suppose there is a Product class with the following fields:
Productld : int
ProductName : string
Price : decimal
Category : an enum which can have one of the three possibilities of SPORTS, BOOKS, ELECTRONICS
Description : string
An example of a Product object will be
{12341, "Calculator", 24.95m, ELECTRONICS, "Solar powered Scientific"}
Suppose there is an OnlineStore class that has an array of Products. Initialize 3 products belonging to each category of SPORTS, BOOKS and ELECTRONICS (total of 9 products in the constructor for OnlineStore). Then develop the following indexers in a Test Driven Development (TDD) style.
1. Search by Productld
2. Search by ProductName
3. Search by partial description e.g., if you searched by "solar", the calculator will match.
4. Search by category.
Note that the search by partial description and search by category will return an array of products.
Show the unit tests for all above cases.