Esempio n. 1
0
        public async Task NoSubscriptionWithoutConnectTest()
        {
            var jsevent = new JsEvent(new Mock <IJSRuntime>().Object);

            Assert.Throws <InvalidOperationException>(() => jsevent.Paste += x => Console.WriteLine(x));
            Assert.Throws <InvalidOperationException>(() => jsevent.CaretPositionChanged += x => Console.WriteLine(x));
            Assert.Throws <InvalidOperationException>(() => jsevent.Select += (x, y) => Console.WriteLine());
            Assert.Throws <InvalidOperationException>(() => jsevent.Subscribe("copy"));
            // unsubscribing before connection is ignored
            await jsevent.Unsubscribe("copy");

            await jsevent.Disconnect();

            await jsevent.UnsubscribeAll();

            jsevent.Dispose();
        }