using Glass.Testbed; using System; using System.Runtime.CompilerServices; using UnitTestSharp; namespace Glass.Blacklight.UnitTests { public class WidgetsTests : TestFixture { // These run in a process where nothing has bound the Testbed's fonts, so every static style finds a null font. public class StaticInitializationTests : TestFixture { public void BeforeTheFontsLoadFailsAtTheFont() { TypeInitializationException thrown = null; try { RuntimeHelpers.RunClassConstructor(typeof(Widgets).TypeHandle); } catch (TypeInitializationException exception) { thrown = exception; } CheckNotNull(thrown); CheckEqual(typeof(InvalidOperationException), thrown.InnerException.GetType()); CheckTrue(thrown.InnerException.Message.Contains("Widgets was used before the renderer bound")); } } } }