Exemplo n.º 1
0
        public void WidgetViewSignalDisconnect()
        {
            tlog.Debug(tag, $"WidgetViewSignalDisconnect START");

            var testingTarget = new WidgetViewSignal();

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <WidgetViewSignal>(testingTarget, "Should be an Instance of WidgetViewSignal!");

            SignalCallback signalCallback = new SignalCallback(MyDelegate);

            try
            {
                testingTarget.Connect(signalCallback);
                Assert.AreEqual(1, testingTarget.GetConnectionCount(), "Should be one here!");

                testingTarget.Disconnect(signalCallback);
                Assert.AreEqual(0, testingTarget.GetConnectionCount(), "Should be zero here!");
            }
            catch (Exception e)
            {
                Assert.Fail("Caught Exception" + e.ToString());
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"WidgetViewSignalDisconnect END (OK)");
        }
Exemplo n.º 2
0
        public void WidgetViewSignalDisconnectWithNull()
        {
            tlog.Debug(tag, $"WidgetViewSignalDisconnect START");

            var testingTarget = new WidgetViewSignal();

            Assert.IsNotNull(testingTarget, "Should be not null!");
            Assert.IsInstanceOf <WidgetViewSignal>(testingTarget, "Should be an Instance of WidgetViewSignal!");

            try
            {
                testingTarget.Disconnect(null);
                Assert.Fail("Should throw the ArgumentNullException!");
            }
            catch (ArgumentNullException e)
            {
                Assert.True(true);
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"WidgetViewSignalDisconnect END (OK)");
        }