コード例 #1
0
ファイル: AsyncTests.cs プロジェクト: zplus/csnng
 private static void WaitForDoneAndSuccess(BasicAsyncServiceFixture svc, ErrorCode ec)
 {
     svc.Wait();
     Assert.Equal(1, svc.Done);
     Assert.Throws <NanoException>(() => svc.Success)
     .Matching(ex => ex.ErrorNumber.ToErrorCode() == ec);
 }
コード例 #2
0
ファイル: AsyncTests.cs プロジェクト: zplus/csnng
        private void Failure_mode_assumptions(FailureModeDelegate callback)
        {
            Section("failure modes work", () =>
            {
                LatestPairSocket s = null;

                // We will leverage the Fixtured Done field.
                BasicAsyncServiceFixture svc = null;

                try
                {
                    s = CreateOne <LatestPairSocket>();

                    // TODO: TBD: ditto CreateAsyncService...
                    svc = CreateAsyncService <BasicAsyncServiceFixture>();
                    svc.Start(() => ++ svc.Done);

                    Assert.Equal(0, svc.Done);

                    callback(s, svc);
                }
                finally
                {
                    DisposeAll(s, svc);
                }
            });
        }