From 1078ea317db0ab98fac2c71ce6d8e3ca61801271 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Fri, 25 Jun 2021 16:37:37 +1000 Subject: [PATCH] Test - Add MethodRunnerQueueFacts.DisposeQueueThenEnqueueMethodInvocation Test to validate that MethodRunnerQueue doesn't have the same issues as #3639 --- CefSharp.Test/CefSharp.Test.csproj | 1 + .../Framework/MethodRunnerQueueFacts.cs | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 CefSharp.Test/Framework/MethodRunnerQueueFacts.cs diff --git a/CefSharp.Test/CefSharp.Test.csproj b/CefSharp.Test/CefSharp.Test.csproj index 6cb03819c..1eb7821e8 100644 --- a/CefSharp.Test/CefSharp.Test.csproj +++ b/CefSharp.Test/CefSharp.Test.csproj @@ -156,6 +156,7 @@ + diff --git a/CefSharp.Test/Framework/MethodRunnerQueueFacts.cs b/CefSharp.Test/Framework/MethodRunnerQueueFacts.cs new file mode 100644 index 000000000..8b2f962bc --- /dev/null +++ b/CefSharp.Test/Framework/MethodRunnerQueueFacts.cs @@ -0,0 +1,35 @@ +// Copyright © 2021 The CefSharp Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. + +using CefSharp.Internals; +using Xunit; + +namespace CefSharp.Test.Framework +{ + public class MethodRunnerQueueFacts + { + [Fact] + public void DisposeQueueThenEnqueueMethodInvocation() + { + var methodInvocation = new MethodInvocation(1, 1, 1, "Testing", 1); + methodInvocation.Parameters.Add("Echo Me!"); + + var objectRepository = new JavascriptObjectRepository + { + NameConverter = null + }; + + var methodRunnerQueue = new MethodRunnerQueue(objectRepository); + + //Dispose + methodRunnerQueue.Dispose(); + + //Enqueue + var ex = Record.Exception(() => methodRunnerQueue.Enqueue(methodInvocation)); + + //Ensure no exception thrown + Assert.Null(ex); + } + } +}