Exemplo n.º 1
0
        public async Task Status()
        {
            using (AmbientClock.Pause())
            {
                Status           s   = new Status(false);
                LocalDiskAuditor lda = null;
                try
                {
                    //System.Text.StringBuilder str = new System.Text.StringBuilder();
                    //str.AppendLine();
                    //str.AppendLine(Environment.GetFolderPath(Environment.SpecialFolder.System));
                    //str.AppendLine(System.IO.Path.GetTempPath());
                    //str.AppendLine(Path.GetPathRoot(System.IO.Path.GetTempPath()));
                    //Assert.Fail(str.ToString());
                    lda = new LocalDiskAuditor();
                    s.AddCheckerOrAuditor(lda);
                    await s.Start();

                    // run all the tests (just the one here) right now
                    await s.RefreshAsync();

                    StatusAuditAlert a = s.Summary;
                    Assert.AreEqual(StatusRatingRange.Okay, StatusRating.FindRange(a.Rating));
                }
                finally
                {
                    await s.Stop();

                    if (lda != null)
                    {
                        s.RemoveCheckerOrAuditor(lda);                  // note that lda could be null if the constructor throws!
                    }
                }
            }
        }
Exemplo n.º 2
0
        public async Task StatusAddRemoveChecker()
        {
            Status s = new Status(false);

            using (TestMachineConstantStatus checkerToAdd = new TestMachineConstantStatus())
            {
                s.AddCheckerOrAuditor(checkerToAdd);
                await s.Start();

                await s.Stop();

                s.RemoveCheckerOrAuditor(checkerToAdd);
            }
            using (TestMachineConstantStatus checkerToAdd = new TestMachineConstantStatus())
            {
                s.AddCheckerOrAuditor(checkerToAdd);
                await s.Start();

                await s.Stop();

                s.RemoveCheckerOrAuditor(checkerToAdd);
            }
        }
Exemplo n.º 3
0
        public async Task StatusAuditAfterDisposal()
        {
            Status s = new Status(false);

            using (TestConstantAuditResults auditorToAdd = new TestConstantAuditResults(null, nameof(StatusAuditAfterDisposal), StatusRating.Okay, nameof(StatusAuditAfterDisposal), "Terse", "Details"))
            {
                s.AddCheckerOrAuditor(auditorToAdd);
                await s.Start();

                await s.Stop();

                s.RemoveCheckerOrAuditor(auditorToAdd);
                // run the initial audit manually and synchronously
                auditorToAdd.InitialAuditTimer_Elapsed(null, null);
            }
        }