Пример #1
0
        public void SurfaceCollection_TestWillNotAddNullSurface_ReturnsFalse()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            Assert.False(collection.Add(0, null));
        }
Пример #2
0
        public void SurfaceCollection_TestWillNotAddSurfaceAtExistingId_ReturnsFalse()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            collection.Add(50, new GpuSurface());
            Assert.False(collection.Add(50, new GpuSurface()));
        }
Пример #3
0
        public void SurfaceCollection_TestMultiFlagCountType_Returns1CountOfInternalTexture()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            AddToCollectionTwoInternalTwoRenderTargetsAndOneTexture(collection);

            Assert.Equal(1, collection.CountOfType(GpuSurfaceType.Internal | GpuSurfaceType.Texture));
        }
Пример #4
0
        public void SurfaceCollection_TestCountAll_Returns5()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            AddToCollectionTwoInternalTwoRenderTargetsAndOneTexture(collection);

            Assert.Equal(5, collection.CountAll());
        }
Пример #5
0
        public void SurfaceCollection_TestRemoveAtIdFailsIfIdNotPresent_ReturnsFalse()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            AddToCollectionTwoInternalTwoRenderTargetsAndOneTexture(collection);

            Assert.False(collection.Remove(7));
        }
Пример #6
0
        public void SurfaceCollection_TestRetrieveAtId_ReturnsSurfaceWithUndefinedType()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            AddToCollectionTwoInternalTwoRenderTargetsAndOneTexture(collection);

            var surface = collection.Retrieve(1);

            Assert.Equal(GpuSurfaceType.Undefined, surface.Type);
        }
Пример #7
0
        public void SurfaceCollection_TestRemoveTypeTexture_Returns3()
        {
            var messenger = Substitute.For <IFrameworkMessenger>();

            var collection = new GpuSurfaceCollection(messenger);

            AddToCollectionTwoInternalTwoRenderTargetsAndOneTexture(collection);

            var ids = collection.ReturnAllOfType(GpuSurfaceType.Texture);

            ids.ForEach(id =>
            {
                collection.Remove(id);
            });

            Assert.Equal(3, collection.CountAll());
        }