using System; using UnitTestSharp; namespace Blacklight.Core.UnitTests { public class GraphicsDeviceFailedExceptionTests : TestFixture { public class CtorTests : TestFixture { public void KeepsTheFailure() { var exception = new GraphicsDeviceFailedException(GraphicsDeviceFailure.Removed, innerException: null); CheckEqual(GraphicsDeviceFailure.Removed, exception.Failure); } public void KeepsTheInnerException() { var inner = new InvalidOperationException(); var exception = new GraphicsDeviceFailedException(GraphicsDeviceFailure.Hung, inner); CheckEqual(inner, exception.InnerException); } public void EachFailure_HasItsOwnMessage() { string hung = new GraphicsDeviceFailedException(GraphicsDeviceFailure.Hung, null).Message; string removed = new GraphicsDeviceFailedException(GraphicsDeviceFailure.Removed, null).Message; CheckNotEqual(hung, removed); } public void UndefinedFailure_Throws() { CheckThrow(typeof(ArgumentOutOfRangeException)); new GraphicsDeviceFailedException((GraphicsDeviceFailure)(-1), innerException: null); } } } }