C# Класс Nuclex.Testing.Xna.MockedGraphicsDeviceService

Helper for unit tests requiring a mocked graphics device
This doesn't actually mock the graphics device, but creates a real graphics device on an invisible window. Tests have shown this method to be fast enough for usage in a unit test.
Наследование: IGraphicsDeviceService
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CreateDevice ( ) : IDisposable

Creates a new graphics device

Make sure to call DestroyGraphicsDevice() either manually, or by disposing the returned object. A typical usage of this method is shown in the following code.

using(IDisposable keeper = CreateDevice()) { GraphicsDevice.DoSomethingThatCouldFail(); }
DestroyDevice ( ) : void

Destroys the created graphics device again

MockedGraphicsDeviceService ( )

Initializs a new mocked graphics device service

MockedGraphicsDeviceService ( DeviceType deviceType )

Initializs a new mocked graphics device service

MockedGraphicsDeviceService ( DeviceType deviceType, GraphicsProfile graphicsProfile )

Initializs a new mocked graphics device service

ResetDevice ( ) : void

Performs a graphics device reset

Защищенные методы

Метод Описание
OnDeviceCreated ( ) : void

Fires the DeviceCreated event

OnDeviceDisposing ( ) : void

Fires the DeviceDisposing event

OnDeviceReset ( ) : void

Fires the DeviceReset event

OnDeviceResetting ( ) : void

Fires the DeviceResetting event

Приватные методы

Метод Описание
disposeEverything ( ) : void

Shuts down and disposes all resources used by the mocked graphics device service

Описание методов

CreateDevice() публичный Метод

Creates a new graphics device

Make sure to call DestroyGraphicsDevice() either manually, or by disposing the returned object. A typical usage of this method is shown in the following code.

using(IDisposable keeper = CreateDevice()) { GraphicsDevice.DoSomethingThatCouldFail(); }
public CreateDevice ( ) : IDisposable
Результат IDisposable

DestroyDevice() публичный Метод

Destroys the created graphics device again
public DestroyDevice ( ) : void
Результат void

MockedGraphicsDeviceService() публичный Метод

Initializs a new mocked graphics device service

MockedGraphicsDeviceService() публичный Метод

Initializs a new mocked graphics device service
public MockedGraphicsDeviceService ( DeviceType deviceType )
deviceType DeviceType Type of graphics device that will be created

MockedGraphicsDeviceService() публичный Метод

Initializs a new mocked graphics device service
public MockedGraphicsDeviceService ( DeviceType deviceType, GraphicsProfile graphicsProfile )
deviceType DeviceType Type of graphics device that will be created
graphicsProfile GraphicsProfile Profile the graphics device will be initialized for

OnDeviceCreated() защищенный Метод

Fires the DeviceCreated event
protected OnDeviceCreated ( ) : void
Результат void

OnDeviceDisposing() защищенный Метод

Fires the DeviceDisposing event
protected OnDeviceDisposing ( ) : void
Результат void

OnDeviceReset() защищенный Метод

Fires the DeviceReset event
protected OnDeviceReset ( ) : void
Результат void

OnDeviceResetting() защищенный Метод

Fires the DeviceResetting event
protected OnDeviceResetting ( ) : void
Результат void

ResetDevice() публичный Метод

Performs a graphics device reset
public ResetDevice ( ) : void
Результат void