Пример #1
0
            public void NullToDateWithNowAfterTwoWeeks_ReturnsDeltaOfActive()
            {
                // arrange
                ContractListDetail detail = new ContractListDetail {
                    Id          = 21,
                    CatalogId   = "FUT",
                    Category    = "Fake Category",
                    Each        = true,
                    FromDate    = new DateTime(2017, 7, 1),
                    HeaderId    = 10,
                    ItemNumber  = "123456",
                    LineNumber  = 17,
                    CreatedUtc  = new DateTime(2017, 7, 5, 16, 41, 0, DateTimeKind.Utc),
                    ModifiedUtc = new DateTime(2017, 7, 5, 16, 42, 0, DateTimeKind.Utc)
                };
                string expected = "active";

                // act
                SystemTime.Set(new DateTime(2017, 7, 20));
                ListItemModel results = detail.ToWebModel();

                SystemTime.Reset();

                // assert
                results.Delta
                .Should()
                .Be(expected);
            }
        public void Cleanup()
        {
            CleanupInternal();

            if (DownloadService.GetTransferStatus(Token.TransferId) != TransferStatus.UnknownTransfer)
            {
                DownloadService.CancelTransfer(Token.TransferId, AbortReason.Undefined);
            }

            SystemTime.Reset();
            RootDir.Delete(true);
        }
Пример #3
0
        /// <summary>
        /// Cancels the current download, if the <see cref="Token"/>
        /// is set, and resets the <see cref="SystemTime"/>.
        /// </summary>
        protected override void CleanupInternal()
        {
            if (Token != null)
            {
                if (Downloads.GetTransferStatus(Token.TransferId) != TransferStatus.UnknownTransfer)
                {
                    Downloads.CancelTransfer(Token.TransferId, AbortReason.Undefined);
                }
            }

            SystemTime.Reset();
            base.CleanupInternal();
        }
Пример #4
0
        public void SystemTime_WhenSetThenReset_ReturnsDifferentTime()
        {
            SystemTime time       = Generate();
            DateTime   testTime   = new DateTime(1990, 1, 1);
            DateTime   assertTime = new DateTime();

            SystemTime.Set(testTime);
            SystemTime.Reset();

            assertTime = time.Now;

            Assert.AreNotEqual(testTime, assertTime);
        }
        protected override void CleanupInternal()
        {
            if (Token != null)
            {
                if (UploadHandler.GetTransferStatus(Token.TransferId) != TransferStatus.UnknownTransfer)
                {
                    UploadHandler.CancelTransfer(Token.TransferId, AbortReason.Undefined);
                }
            }

            SystemTime.Reset();
            ParentDirectory.Delete(true);

            base.CleanupInternal();
        }
Пример #6
0
        public void MixedFixtureSetup()
        {
            //в качестве начального значения используется время если оно совпадет то и значения будут идентичные
            //для этого тесты должны иметь общий генератор случайных чисел
            random = new Random();
            begin  = DateTime.Now;
            SystemTime.Reset();

            cleaner    = new FileCleaner();
            disposable = new CompositeDisposable();
            disposable.Add(cleaner);

            fixtureHelper = new FixtureHelper();
            disposable.Add(fixtureHelper);

            clientConfig  = Integration.IntegrationSetup.clientConfig;
            serviceConfig = Integration.IntegrationSetup.serviceConfig;

            FileHelper.InitDir(serviceConfig.RtmUpdatePath,
                               clientConfig.TmpDir,
                               Path.Combine(ConfigurationManager.AppSettings["ClientDocPath"], "АналитФАРМАЦИЯ"));

            localSession   = Integration.IntegrationSetup.Factory.OpenSession();
            localStateless = Integration.IntegrationSetup.Factory.OpenStatelessSession();

            settings = localSession.Query <Settings>().First();
            address  = localSession.Query <Address>().First();

            ViewModelFixture.StubWindowManager();

            var debugTest = Environment.GetEnvironmentVariable("DEBUG_TEST");

            if (debugTest.Match(TestContext.CurrentContext.Test.Name))
            {
                var repository = (Hierarchy)LogManager.GetRepository();
                repository.Configured = true;
                var logger = (Logger)repository.GetLogger("AnalitF.Net");
                if (logger.Level == null || logger.Level > Level.Warn)
                {
                    logger.Level = Level.Warn;
                }
                var appender = new ConsoleAppender(new PatternLayout(PatternLayout.DefaultConversionPattern));
                appender.ActivateOptions();
                logger.AddAppender(appender);
            }
        }
Пример #7
0
            public void GoodDetailWithNowLessThanTwoWeeks_ReturnsDeltaOfAddedAndActive()
            {
                // arrange
                ContractListDetail detail   = MakeDetail();
                string             expected = "newly added active";

                // act
                SystemTime.Set(new DateTime(2017, 7, 17));
                ListItemModel results = detail.ToWebModel();

                SystemTime.Reset();

                // assert
                results.Delta
                .Should()
                .Be(expected);
            }
Пример #8
0
            public void GoodDetailWithNowFifteenDaysout_ReturnsDeltaOfActive()
            {
                // arrange
                ContractListDetail detail   = MakeDetail();
                string             expected = "active";

                // act
                SystemTime.Set(new DateTime(2017, 7, 20));
                ListItemModel results = detail.ToWebModel();

                SystemTime.Reset();

                // assert
                results.Delta
                .Should()
                .Be(expected);
            }
Пример #9
0
            public void GoodDetailWithNowGreaterThanToDate_ReturnsDeltaOfDeleted()
            {
                // arrange
                ContractListDetail detail   = MakeDetail();
                string             expected = "newly deleted";

                // act
                SystemTime.Set(new DateTime(2017, 8, 1));
                ListItemModel results = detail.ToWebModel();

                SystemTime.Reset();

                // assert
                results.Delta
                .Should()
                .Be(expected);
            }
Пример #10
0
 public void TearDown()
 {
     SystemTime.Reset();
     shell.Config.Quiet = false;
     if (dispatcher != null)
     {
         if (DbHelper.IsTestFail() && DbHelper.IsCI() &&
             activeWindow != null)
         {
             dispatcher.Invoke(() => {
                 PrintFixture.SaveToPng(activeWindow, DbHelper.FailDir("screen.png"));
             });
         }
         dispatcher.Invoke(() => {
             foreach (var window in windows.ToArray().Reverse())
             {
                 window.Close();
             }
         });
         WaitIdle();
         dispatcher.Invoke(() => shell.Dispose());
         dispatcher.InvokeShutdown();
     }
 }
Пример #11
0
 public void AdmIntegrationTearDown()
 {
     SystemTime.Reset();
 }
 public void Dispose()
 {
     SystemTime.Reset();
 }
Пример #13
0
 public SystemTimeTests()
 {
     SystemTime.Reset();
 }
Пример #14
0
 public void afterEachTest()
 {
     // Reset date at the end of each test
     SystemTime.Reset();
 }
 protected void TearDown()
 {
     SystemTime.Reset();
 }
 public void After()
 {
     SystemTime.Reset();
 }
Пример #17
0
 public void Cleanup()
 {
     SystemTime.Reset();
 }
Пример #18
0
 public void AfterEachTest()
 {
     SystemTime.Reset(); //Zresetowanie daty na koñcu ka¿dego testu
 }
Пример #19
0
 public override void TearDown()
 {
     SystemTime.Reset();
 }
 public void afterEachTest()
 {
     SystemTime.Reset();
 }
Пример #21
0
 public void Teardown()
 {
     SystemTime.Reset();
 }
Пример #22
0
 public void TearDown()
 {
     SystemTime.Reset();
     SystemGuid.Reset();
 }
Пример #23
0
 public void AfterEachTest()
 {
     //每次测试结束时重置日期
     SystemTime.Reset();
 }