Пример #1
0
        public void TestSimpleConstructor()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                using (
                    TestIndexedStaticMesh test = new TestIndexedStaticMesh(
                        mockGraphicsDeviceService.GraphicsDevice, 4, 4
                        )
                    ) { }
            }
        }
Пример #2
0
        public void TestThrowInSimpleConstructorRollback()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                Assert.Throws <ArgumentOutOfRangeException>(
                    delegate() {
                    using (
                        TestIndexedStaticMesh test = new TestIndexedStaticMesh(
                            mockGraphicsDeviceService.GraphicsDevice, 4, -1
                            )
                        ) { }
                }
                    );
            }
        }
Пример #3
0
        public void TestSelect()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                using (
                    TestIndexedStaticMesh test = new TestIndexedStaticMesh(
                        mockGraphicsDeviceService.GraphicsDevice, 4, 4
                        )
                    ) {
                    test.Select();
                    Assert.AreSame(
                        test.IndexBuffer,
                        mockGraphicsDeviceService.GraphicsDevice.Indices
                        );
                }
            }
        }
Пример #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 (
                        TestIndexedStaticMesh test = new TestIndexedStaticMesh(
                            mockGraphicsDeviceService.GraphicsDevice, declaration, 4, 4
                            )
                        ) { }
                }
            }
        }
Пример #5
0
        public void TestThrowInFullConstructorRollback()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                VertexElement[] elements = VertexDeclarationHelper.BuildElementList <TestVertex>();
                using (
                    VertexDeclaration declaration = new VertexDeclaration(
                        mockGraphicsDeviceService.GraphicsDevice, elements
                        )
                    ) {
                    Assert.Throws <ArgumentOutOfRangeException>(
                        delegate() {
                        using (
                            TestIndexedStaticMesh test = new TestIndexedStaticMesh(
                                mockGraphicsDeviceService.GraphicsDevice, declaration, 4, -1
                                )
                            ) { }
                    }
                        );
                }
            }
        }