示例#1
0
        public async Task A_Invoke_Async_Parameters()
        {
            // Arrange
            var ee = new EventHandler();
            var a  = new A(ee);

            // Act
            await ee.InvokeAsync("SetName", "Test");

            // Assert
            Assert.AreEqual("Test", a.Name);
        }
示例#2
0
        public async Task A_Invoke_Async()
        {
            // Arrange
            var ee = new EventHandler();
            var a  = new A(ee);

            // Act
            await ee.InvokeAsync("Update");

            // Assert
            Assert.IsTrue(a.Enabled);
            Assert.AreEqual(1, a.UpdateCalled);
        }
示例#3
0
        public async Task A_Acquire_T_Async()
        {
            // Arrange
            var ee = new EventHandler();

            new A(ee);

            // Act
            await ee.InvokeAsync("Update");

            var result1 = await ee.AcquireAsync <bool>("GetUpdate");

            var result2 = await ee.AcquireAsync <int>("GetUpdate");

            // Assert
            CollectionAssert.AreEqual(result1.ToArray(), new bool[] { });
            CollectionAssert.AreEqual(result2.ToArray(), new int[] { 1 });
        }