Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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);
                }
            });
        }