using System; using System.Linq; using ComputeSharp.Exceptions; using ComputeSharp.Graphics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests { [TestClass] [TestCategory("InvalidShader")] public class InvalidShaderTests { [TestMethod] public void EmptyShaderCompileError() { Action action = id => { }; Assert.ThrowsException(() => Gpu.Default.For(10, action)); } [TestMethod] public void DeviceMismatchException() { ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(1); GraphicsDevice device = Gpu.EnumerateDevices().First(); Action action = id => buffer[0] = 1; Assert.ThrowsException(() => device.For(1, action)); } } }