Implement MachineKey.Protect and MachineKey.Unprotect
[mono.git] / mcs / class / System.ComponentModel.Composition / Tests / UnitTestFramework / System / UnitTesting / TestServices.cs
1 // -----------------------------------------------------------------------\r
2 // Copyright (c) Microsoft Corporation.  All rights reserved.\r
3 // -----------------------------------------------------------------------\r
4 using System;\r
5 using System.Reflection;\r
6 using System.Collections.Generic;\r
7 \r
8 namespace System.UnitTesting\r
9 {\r
10     public static class TestServices\r
11     {\r
12         public static string GenerateRandomString()\r
13         {\r
14             return Guid.NewGuid().ToString().Replace('-', '_');\r
15         }\r
16 \r
17         public static IEnumerable<TEnum> GetEnumValues<TEnum>() where TEnum : struct\r
18         {   // Silverlight 2.0 does not have Enum.GetValues() \r
19             // so we need to write our own\r
20 \r
21             foreach (FieldInfo field in typeof(TEnum).GetFields())\r
22             {\r
23                 if (!field.IsLiteral)\r
24                     continue;\r
25 \r
26                 yield return (TEnum)field.GetRawConstantValue();\r
27             }\r
28         }\r
29     }\r
30 }