From 10e35c4991ad882a7422233fe17cda2ee9511964 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 6 Sep 2019 21:53:44 +0200 Subject: [PATCH] Added test for new exception --- tests/ComputeSharp.Tests/InvalidShaderTests.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/ComputeSharp.Tests/InvalidShaderTests.cs b/tests/ComputeSharp.Tests/InvalidShaderTests.cs index cfd18b75..393dbfba 100644 --- a/tests/ComputeSharp.Tests/InvalidShaderTests.cs +++ b/tests/ComputeSharp.Tests/InvalidShaderTests.cs @@ -1,4 +1,7 @@ using System; +using System.Linq; +using ComputeSharp.Exceptions; +using ComputeSharp.Graphics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests @@ -14,6 +17,18 @@ namespace ComputeSharp.Tests 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)); + } } }