using Amphora; using Blacklight.Core; using UnitTestSharp; namespace Foundations.UnitTests { public class DesktopFlagsTests : TestFixture { public static FlagRegistry Desktop() { return FlagRegistry.ScanTypes(new[] { typeof(DesktopFlags), typeof(GraphicsFlags) }); } public class VsyncTests : TestFixture { public void IsOnUnlessTurnedOff() { CheckTrue(Desktop().Parse(new string[0]).Value.Get(DesktopFlags.Vsync)); CheckFalse(Desktop().Parse(new[] { "--novsync" }).Value.Get(DesktopFlags.Vsync)); } } public class ExitAfterFirstFrameTests : TestFixture { public void IsOffUnlessGiven() { CheckFalse(Desktop().Parse(new string[0]).Value.Get(DesktopFlags.ExitAfterFirstFrame)); Flags flags = Desktop().Parse(new[] { "--exitafterfirstframe" }).Value; CheckTrue(flags.Get(DesktopFlags.ExitAfterFirstFrame)); } } public class WarmupTests : TestFixture { public void IsOnUnlessTurnedOff() { CheckTrue(Desktop().Parse(new string[0]).Value.Get(DesktopFlags.Warmup)); CheckFalse(Desktop().Parse(new[] { "--nowarmup" }).Value.Get(DesktopFlags.Warmup)); } } public class TheDesktopAssembliesTests : TestFixture { public void DeclareNoFlagsThatClash() { FlagRegistry registry = FlagRegistry.ScanAssemblies(new[] { typeof(DesktopFlags).Assembly, typeof(GraphicsFlags).Assembly, typeof(Startup).Assembly, }); CheckEqual(5, registry.Count); } } } }