public static void AddTestDocuments()
        {
            if (!_isSetup)
            {
                return; // DB wasn't touched, so nothing to do here
            }
            var dbUri = VstsSettings.GetSetting("dbUri", DefaultDbUri);

            if (dbUri != DefaultDbUri)
            {
                return; // this data is only to help local devs - don't put on live site
            }
            using (var repository = New(deleteAllDocuments: false).Register())
            {
                DomainRegistry.ValidationContext = new ValidationContext(true);
                DomainRegistry.NowUtc            = () => DateTime.UtcNow;
                DomainRegistry.CloudStore        = LocalCloudStore.New(clearContainer: false);

                AddTestBsg(repository, "unitTest");

                var coc = AddTestCoc(repository, "unitTest");

                AddTestBsg(repository, "unitTestExisting", bsg =>
                {
                    bsg.ApplicantDetails.EmailAddress = coc.UserId;

                    Builder.Modify(bsg)
                    .With(f => f.UserId, coc.UserId)
                    .With(f => f.Declaration, BestStartGrantForms.Dto.DeclarationBuilder.NewValid())
                    .With(f => f.Completed, DateTime.UtcNow);
                });
            }
        }
예제 #2
0
 protected virtual void SetUp()
 {
     Repository = LocalRepository.New().Register();
     DomainRegistry.ValidationContext = new ValidationContext(true);
     CloudStore            = LocalCloudStore.New().Register();
     DomainRegistry.NowUtc = () => TestNowUtc ?? DateTime.UtcNow;
     TestNowUtc            = new DateTime(2015, 07, 16, 12, 00, 00);
 }