public void A_Invoke_Parameters() { // Arrange var ee = new EventHandler(); var a = new A(ee); // Act ee.Invoke("SetName", "Test"); // Assert Assert.AreEqual("Test", a.Name); }
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); }
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); }
public void A_Invoke() { // Arrange var ee = new EventHandler(); var a = new A(ee); // Act ee.Invoke("Update"); // Assert Assert.IsTrue(a.Enabled); Assert.AreEqual(1, a.UpdateCalled); }
public async Task A_Acquire_Async() { // Arrange var ee = new EventHandler(); new A(ee); // Act var result = await ee.AcquireAsync("Update"); // Assert CollectionAssert.AreEqual(result.ToArray(), new object[] { null }); }
public void B_Invoke() { // Arrange var ee = new EventHandler(); var b = new B(ee); // Act ee.Invoke("Update"); // Assert Assert.IsTrue(b.Enabled); Assert.AreEqual(10, b.UpdateCalled); }
public void A_Invoke_Static() { // Arrange var ee = new EventHandler(); new A(ee); // Act var result = ee.Acquire <bool>("StaticUpdate"); // Assert CollectionAssert.AreNotEqual(new[] { true }, result.ToArray()); }
public void A_Invoke_Disabled() { // Arrange var ee = new EventHandler(); var a = new A(ee, false); // Act ee.Invoke("Update"); // Assert Assert.IsFalse(a.Enabled); Assert.AreEqual(0, a.UpdateCalled); }
public void A_Acquire() { // Arrange var ee = new EventHandler(); new A(ee); // Act var result = ee.Acquire("Update"); // Assert CollectionAssert.AreEqual(result.ToArray(), new object[] { null }); }
public void AB_Invoke_EndEarly() { // Arrange var ee = new EventHandler(); var b = new B(ee); var a = new A(ee); // Act ee.Invoke("PartialUpdate"); // Assert Assert.AreEqual(0, a.UpdateCalled); Assert.AreEqual(10, b.UpdateCalled); }
public void A_Invoke_Property() { // Arrange var ee = new EventHandler(); var a = new A(ee); // Act ee.Invoke("Update"); var result = ee.Acquire("UpdateCalled"); // Assert Assert.AreEqual(1, a.UpdateCalled); CollectionAssert.AreNotEqual(new[] { true }, result.ToArray()); }
public void A_Acquire_T() { // Arrange var ee = new EventHandler(); new A(ee); // Act ee.Invoke("Update"); var result1 = ee.Acquire <bool>("GetUpdate"); var result2 = ee.Acquire <int>("GetUpdate"); // Assert CollectionAssert.AreEqual(result1.ToArray(), new bool[] { }); CollectionAssert.AreEqual(result2.ToArray(), new int[] { 1 }); }
public void A_Invoke_InScope() { // Arrange var ee = new EventHandler(); var a = new A(ee); // Act using (a) { ee.Invoke("Update"); } ee.Invoke("Update"); // Assert Assert.IsFalse(a.Enabled); Assert.AreEqual(1, a.UpdateCalled); }
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 }); }