예제 #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
            }
        }
        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 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 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
      }
    }