public void SurfaceFactory_CreatesSurfaceSucceeds_ComponentsAreNotNullAndTypeIsCorrect() { var messenger = Substitute.For <IFrameworkMessenger>(); var components = new FakeComponents(); IGpuSurfaceFactory factory = new GpuSurfaceFactory(messenger, components); var surface = factory.CreateGpuSurface(true, 100, 100, Veldrid.PixelFormat.R32_G32_B32_A32_Float, false, SamplerType.Anisotropic, 1, false); Assert.Equal(GpuSurfaceType.RenderTarget | GpuSurfaceType.Internal, surface.Type); Assert.NotNull(surface.Texture); Assert.NotNull(surface.TextureView); Assert.NotNull(surface.ResourceSet_TexMirror); Assert.NotNull(surface.ResourceSet_TexWrap); components.ReleaseResources(); }
public void SurfaceFactory_CreatesSurfaceCatchesInvalidInput_ThrowsExceptionWhenDimensionsAreZero() { var messenger = Substitute.For <IFrameworkMessenger>(); var components = Substitute.For <ISystemComponents>(); IGpuSurfaceFactory factory = new GpuSurfaceFactory(messenger, components); Assert.Throws <Yak2DException>(() => { factory.CreateGpuSurface(false, 0, 0, Veldrid.PixelFormat.R32_G32_B32_A32_Float, false, SamplerType.Anisotropic, 1, false); }); components.ReleaseResources(); }