Ejemplo n.º 1
0
        public void TestSelect()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                using (
                    TestStaticMesh test = new TestStaticMesh(
                        mockGraphicsDeviceService.GraphicsDevice, 4
                        )
                    ) {
                    test.Select();
#if XNA_4
                    Assert.AreSame(
                        test.VertexBuffer,
                        mockGraphicsDeviceService.GraphicsDevice.GetVertexBuffers()[0].VertexBuffer
                        );
#else
                    Assert.AreSame(
                        test.VertexBuffer,
                        mockGraphicsDeviceService.GraphicsDevice.Vertices[0].VertexBuffer
                        );
#endif
                }
            }
        }
Ejemplo n.º 2
0
        public void TestSimpleConstructor()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                using (
                    TestStaticMesh test = new TestStaticMesh(
                        mockGraphicsDeviceService.GraphicsDevice, 4
                        )
                    ) { }
            }
        }
Ejemplo n.º 3
0
        public void TestThrowInConstructorRollback()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                Assert.Throws <ArgumentOutOfRangeException>(
                    delegate() {
                    using (
                        TestStaticMesh test = new TestStaticMesh(
                            mockGraphicsDeviceService.GraphicsDevice, -1
                            )
                        ) { }
                }
                    );
            }
        }
Ejemplo n.º 4
0
        public void TestFullConstructor()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                VertexElement[] elements = VertexDeclarationHelper.BuildElementList <TestVertex>();
                using (
                    VertexDeclaration declaration = new VertexDeclaration(
                        mockGraphicsDeviceService.GraphicsDevice, elements
                        )
                    ) {
                    using (
                        TestStaticMesh test = new TestStaticMesh(
                            mockGraphicsDeviceService.GraphicsDevice, declaration, 4
                            )
                        ) { }
                }
            }
        }