public void TestCheckSyncValueTaskIntDynamicWorked(VTaskOptions options) { //SETUP dynamic valueTask = ValueTaskIntMethod(options); int result = 0; //ATTEMPT try { result = ValueTaskSyncCheckers.CheckSyncValueTaskWorkedDynamicAndReturnResult <int>(valueTask); } catch (Exception e) { options.ShouldNotEqual(VTaskOptions.Sync); if (options.HasFlag(VTaskOptions.Async)) { e.Message.ShouldEqual("Expected a sync task, but got an async task"); } if (options.HasFlag(VTaskOptions.ThrowException)) { e.Message.ShouldEqual("Exception thrown"); } return; } //VERIFY options.ShouldEqual(VTaskOptions.Sync); result.ShouldEqual(1); }
public void TestCheckSyncValueTaskIntWorked(VTaskOptions options) { //SETUP var valueTaskInt = ValueTaskIntMethod(options); //ATTEMPT try { valueTaskInt.CheckSyncValueTaskWorkedAndReturnResult(); } catch (Exception e) { options.ShouldNotEqual(VTaskOptions.Sync); if (options.HasFlag(VTaskOptions.Async)) { e.Message.ShouldEqual("Expected a sync task, but got an async task"); } if (options.HasFlag(VTaskOptions.ThrowException)) { e.Message.ShouldEqual("Exception thrown"); } return; } //VERIFY options.ShouldEqual(VTaskOptions.Sync); }