public void ActionProgress() { var a1 = AsyncAction <int> .CreateCompleted(); var a2 = AsyncAction <int> .CreateCompleted(); Assert.AreEqual(AsyncStatus.Completed, a1.Status); Assert.AreSame(a2, a1); a1 = AsyncAction <int> .CreateCanceled(); a2 = AsyncAction <int> .CreateCanceled(); Assert.ThrowsException <OperationCanceledException>(() => a1.GetResults()); Assert.AreEqual(AsyncStatus.Canceled, a1.Status); Assert.AreSame(a2, a1); a1 = AsyncAction <int> .CreateFault(); a2 = AsyncAction <int> .CreateFault(); Assert.AreEqual(AsyncStatus.Error, a1.Status); Assert.ThrowsException <Exception>(() => a1.GetResults()); Assert.IsNotNull(a1.ErrorCode); Assert.AreSame(a2, a1); a1 = AsyncAction <int> .CreateFault(new InvalidOperationException("text")); Assert.AreEqual(AsyncStatus.Error, a1.Status); Assert.ThrowsException <InvalidOperationException>(() => a1.GetResults()); Assert.IsNotNull(a1.ErrorCode); Assert.AreEqual("text", a1.ErrorCode.Message); a1.Close(); Assert.IsNotNull(a1.ErrorCode); Assert.AreEqual("text", a1.ErrorCode.Message); }