1 // -----------------------------------------------------------------------
\r
2 // Copyright (c) Microsoft Corporation. All rights reserved.
\r
3 // -----------------------------------------------------------------------
\r
5 using System.Reflection;
\r
6 using System.Collections.Generic;
\r
8 namespace System.UnitTesting
\r
10 public static class TestServices
\r
12 public static string GenerateRandomString()
\r
14 return Guid.NewGuid().ToString().Replace('-', '_');
\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
21 foreach (FieldInfo field in typeof(TEnum).GetFields())
\r
23 if (!field.IsLiteral)
\r
26 yield return (TEnum)field.GetRawConstantValue();
\r