Exemplo n.º 1
0
        public void TestHashCodeOnDifferingInstances()
        {
            using (
                Texture2D testTexture1 = new Texture2D(
                    this.mockedGraphicsDeviceService.GraphicsDevice,
                    128, 256
                    )
                ) {
                using (
                    Texture2D testTexture2 = new Texture2D(
                        this.mockedGraphicsDeviceService.GraphicsDevice,
                        256, 128
                        )
                    ) {
                    TextureRegion2D region1 = TextureRegion2D.FromTexels(
                        testTexture1, new Point(16, 32), new Point(48, 64)
                        );
                    TextureRegion2D region2 = TextureRegion2D.FromTexels(
                        testTexture1, new Point(80, 96), new Point(112, 128)
                        );

                    Assert.AreNotEqual(region1.GetHashCode(), region2.GetHashCode());
                }
            }
        }
Exemplo n.º 2
0
        public void TestHashCodeOnEquivalentInstances()
        {
            using (
                Texture2D testTexture = new Texture2D(
                    this.mockedGraphicsDeviceService.GraphicsDevice,
                    128, 128
                    )
                ) {
                TextureRegion2D region1 = TextureRegion2D.FromTexels(
                    testTexture, new Point(16, 32), new Point(48, 64)
                    );
                TextureRegion2D region2 = TextureRegion2D.FromTexels(
                    testTexture, new Point(16, 32), new Point(48, 64)
                    );

                Assert.AreEqual(region1.GetHashCode(), region2.GetHashCode());
            }
        }