public void TestMethod1() { MyClass.Buffer = new StringBuilder(); UnitTestManager.Call(() => new Test().Hello()); var txt = MyClass.Buffer.ToString(); Assert.AreEqual("OnReady,OnApiCreated,OnPropertiesParsed,OnArgumentsParsed,OnEnding,", txt); }
public void HelloAsyncTest() { var r = UnitTestManager.Call(() => new Test().HelloAsync()); if (r.Exception != null) { throw r.Exception; } Assert.AreEqual("Hello", r.Result); }
public void CheckPropAsyncTest() { var r = UnitTestManager.Call(() => new Test() { Name = "abc" }.CheckPropAsync("abc")); if (r.Exception != null) { throw r.Exception; } var r2 = UnitTestManager.Call(() => new Test() { Name = "abc1" }.CheckPropAsync("abc")); if (r2.Exception == null) { Assert.Fail(); } }
public void NotApiTest() { var r = UnitTestManager.Call(() => new Test().NotApi()); Assert.IsInstanceOfType(r.Exception, typeof(ApiNotFoundException)); }