예제 #1
0
        public void TestEqualsWithDifferentObject()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
#if XNA_4
                using (BasicEffect effect1 = new BasicEffect(service.GraphicsDevice)) {
                    using (BasicEffect effect2 = new BasicEffect(service.GraphicsDevice)) {
                        TestEffectDrawContext test1 = new TestEffectDrawContext(effect1);
                        TestEffectDrawContext test2 = new TestEffectDrawContext(effect2);
                        Assert.IsFalse(test1.Equals((object)test2));
                    }
                }
#else
                using (EffectPool pool = new EffectPool()) {
                    using (BasicEffect effect1 = new BasicEffect(service.GraphicsDevice, pool)) {
                        using (BasicEffect effect2 = new BasicEffect(service.GraphicsDevice, pool)) {
                            TestEffectDrawContext test1 = new TestEffectDrawContext(effect1);
                            TestEffectDrawContext test2 = new TestEffectDrawContext(effect2);
                            Assert.IsFalse(test1.Equals((object)test2));
                        }
                    }
                }
#endif
            }
        }
예제 #2
0
        public void TestBeginEnd()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
#if XNA_4
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test = new TestEffectDrawContext(effect);

                    for (int pass = 0; pass < test.Passes; ++pass)
                    {
                        test.Apply(pass);
                    }
                }
#else
                using (EffectPool pool = new EffectPool()) {
                    using (BasicEffect effect = new BasicEffect(service.GraphicsDevice, pool)) {
                        TestEffectDrawContext test = new TestEffectDrawContext(effect);

                        test.Begin();
                        try {
                            for (int pass = 0; pass < test.Passes; ++pass)
                            {
                                test.BeginPass(pass);
                                test.EndPass();
                            }
                        }
                        finally {
                            test.End();
                        }
                    }
                }
#endif
            }
        }
        public void TestConstructor()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test = new TestEffectDrawContext(effect);
                    Assert.GreaterOrEqual(test.Passes, 1);
                }
            }
        }
        public void TestEqualsWithSameObject()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test = new TestEffectDrawContext(effect);
                    Assert.IsTrue(test.Equals((object)test));
                }
            }
        }
        public void TestEffectRetrieval()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test = new TestEffectDrawContext(effect);
                    Assert.AreSame(effect, test.Effect);
                }
            }
        }
        public void TestEqualsWithIncpmpatibleDrawContext()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test1 = new TestEffectDrawContext(effect);
                    TestDrawContext       test2 = new TestDrawContext();
                    Assert.IsFalse(test1.Equals((object)test2));
                }
            }
        }
        public void TestBeginEnd()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test = new TestEffectDrawContext(effect);

                    for (int pass = 0; pass < test.Passes; ++pass)
                    {
                        test.Apply(pass);
                    }
                }
            }
        }
예제 #8
0
        public void TestEffectRetrieval()
        {
            MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();

            using (IDisposable keeper = service.CreateDevice()) {
#if XNA_4
                using (BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
                    TestEffectDrawContext test = new TestEffectDrawContext(effect);

                    Assert.AreSame(effect, test.Effect);
                }
#else
                using (EffectPool pool = new EffectPool()) {
                    using (BasicEffect effect = new BasicEffect(service.GraphicsDevice, pool)) {
                        TestEffectDrawContext test = new TestEffectDrawContext(effect);

                        Assert.AreSame(effect, test.Effect);
                    }
                }
#endif
            }
        }
    public void TestEqualsWithIncompatibleEffect() {
      MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();
      using(IDisposable keeper = service.CreateDevice()) {
        using(
          BasicEffectDrawContext test1 = new BasicEffectDrawContext(service.GraphicsDevice)
        ) {
          TestEffectDrawContext test2 = new TestEffectDrawContext(null);

          Assert.IsFalse(test1.Equals((object)test2));
        }
      }
    }
    public void TestEqualsWithIncpmpatibleDrawContext() {
      MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();
      using(IDisposable keeper = service.CreateDevice()) {
#if XNA_4
        using(BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
          TestEffectDrawContext test1 = new TestEffectDrawContext(effect);
          TestDrawContext test2 = new TestDrawContext();
          Assert.IsFalse(test1.Equals((object)test2));
        }
#else
        using(EffectPool pool = new EffectPool()) {
          using(BasicEffect effect = new BasicEffect(service.GraphicsDevice, pool)) {
            TestEffectDrawContext test1 = new TestEffectDrawContext(effect);
            TestDrawContext test2 = new TestDrawContext();
            Assert.IsFalse(test1.Equals((object)test2));
          }
        }
#endif
      }
    }
    public void TestEffectRetrieval() {
      MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();
      using(IDisposable keeper = service.CreateDevice()) {
#if XNA_4
        using(BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
          TestEffectDrawContext test = new TestEffectDrawContext(effect);

          Assert.AreSame(effect, test.Effect);
        }
#else
        using(EffectPool pool = new EffectPool()) {
          using(BasicEffect effect = new BasicEffect(service.GraphicsDevice, pool)) {
            TestEffectDrawContext test = new TestEffectDrawContext(effect);

            Assert.AreSame(effect, test.Effect);
          }
        }
#endif
      }
    }
    public void TestBeginEnd() {
      MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();
      using(IDisposable keeper = service.CreateDevice()) {
#if XNA_4
        using(BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
          TestEffectDrawContext test = new TestEffectDrawContext(effect);

          for(int pass = 0; pass < test.Passes; ++pass) {
            test.Apply(pass);
          }
        }
#else
        using(EffectPool pool = new EffectPool()) {
          using(BasicEffect effect = new BasicEffect(service.GraphicsDevice, pool)) {
            TestEffectDrawContext test = new TestEffectDrawContext(effect);

            test.Begin();
            try {
              for(int pass = 0; pass < test.Passes; ++pass) {
                test.BeginPass(pass);
                test.EndPass();
              }
            }
            finally {
              test.End();
            }
          }
        }
#endif
      }
    }
    public void TestConstructor() {
      MockedGraphicsDeviceService service = new MockedGraphicsDeviceService();
      using(IDisposable keeper = service.CreateDevice()) {
#if XNA_4
        using(BasicEffect effect = new BasicEffect(service.GraphicsDevice)) {
          TestEffectDrawContext test = new TestEffectDrawContext(effect);
          Assert.GreaterOrEqual(test.Passes, 1);
        }
#else
        using(EffectPool pool = new EffectPool()) {
          using(BasicEffect effect = new BasicEffect(service.GraphicsDevice, pool)) {
            TestEffectDrawContext test = new TestEffectDrawContext(effect);
            Assert.GreaterOrEqual(test.Passes, 1);
          }
        }
#endif
      }
    }