public void SetupOrganisationTests()
        {
            _organisationIdCreated = "EPA0987";
            _repository            = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationId1       = "EPA0987";
            _organisation1         = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = 876544,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisationStandard = new OrganisationStandardModel
            {
                Id = _orgStandardId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                StandardCode  = _standardCode,
                Status        = OrganisationStatus.New,
                EffectiveFrom = DateTime.Today.AddDays(-7),
                EffectiveTo   = DateTime.Today.AddDays(10),
                DateStandardApprovedOnRegister = DateTime.Today.AddDays(-50),
                Comments = "comments go here"
            };

            _deliveryArea1 = new DeliveryAreaModel {
                Id = 10, Status = "Live", Area = "North West"
            };
            _deliveryArea2 = new DeliveryAreaModel {
                Id = 20, Status = "New", Area = "Some Other"
            };
            var deliveryAreas = new List <DeliveryAreaModel> {
                _deliveryArea1, _deliveryArea2
            };

            DeliveryAreaHandler.InsertRecords(deliveryAreas);

            var deliveryArea1 = new OrganisationStandardDeliveryAreaModel {
                Id                     = _deliveryAreaId1,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea1.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New,
            };

            var deliveryArea2 = new OrganisationStandardDeliveryAreaModel {
                Id                     = _deliveryAreaId2,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea2.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New
            };

            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1
            });
            OrganisationStandardHandler.InsertRecord(_organisationStandard);
            OrganisationStandardDeliveryAreaHandler.InsertRecords(new List <OrganisationStandardDeliveryAreaModel> {
                deliveryArea1, deliveryArea2
            });
        }
        public void SetupOrganisationTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _repository = new RegisterQueryRepository(unitOfWork);

            _organisationIdCreated = "EPA0987";
            _organisationId1       = "EPA0987";
            _organisation1         = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = 876544,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisationStandard = new OrganisationStandardModel
            {
                Id = _orgStandardId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                StandardCode  = _standardCode,
                Status        = OrganisationStatus.New,
                EffectiveFrom = DateTime.Today.AddDays(-7),
                EffectiveTo   = DateTime.Today.AddDays(10),
                DateStandardApprovedOnRegister = DateTime.Today.AddDays(-50),
                Comments = "comments go here"
            };

            _deliveryArea1 = new DeliveryAreaModel {
                Id = 10, Status = "Live", Area = "North West"
            };
            _deliveryArea2 = new DeliveryAreaModel {
                Id = 20, Status = "New", Area = "Some Other"
            };
            var deliveryAreas = new List <DeliveryAreaModel> {
                _deliveryArea1, _deliveryArea2
            };

            DeliveryAreaHandler.InsertRecords(deliveryAreas);

            var deliveryArea1 = new OrganisationStandardDeliveryAreaModel
            {
                Id                     = _deliveryAreaId1,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea1.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New,
            };

            var deliveryArea2 = new OrganisationStandardDeliveryAreaModel
            {
                Id                     = _deliveryAreaId2,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea2.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New
            };

            var organistionStandardVersion1 = new OrganisationStandardVersionModel
            {
                OrganisationStandardId = _orgStandardId,
                StandardUId            = _standardUID1,
                EffectiveFrom          = DateTime.Now.AddMonths(-12),
                EffectiveTo            = DateTime.Now.AddMonths(-3),
                Version             = "1.0",
                DateVersionApproved = DateTime.Now.AddMonths(-12),
                Status = "Live"
            };

            var organistionStandardVersion2 = new OrganisationStandardVersionModel
            {
                OrganisationStandardId = _orgStandardId,
                StandardUId            = _standardUID2,
                EffectiveFrom          = DateTime.Now.AddMonths(-3),
                EffectiveTo            = null,
                Version             = "1.1",
                DateVersionApproved = DateTime.Now.AddMonths(-3),
                Status = "Live"
            };

            var standardModel1 = new StandardModel
            {
                StandardUId          = _standardUID1,
                IFateReferenceNumber = "ST0001",
                Version            = "1.0",
                Title              = "Standard",
                Level              = 4,
                Status             = "Approved for Delivery",
                TypicalDuration    = 12,
                TrailblazerContact = "Contact name",
                StandardPageUrl    = "www.standard.com",
                OverviewOfRole     = "Explanation of apprenticeship job role"
            };

            var standardModel2 = new StandardModel
            {
                StandardUId          = _standardUID2,
                IFateReferenceNumber = "ST0001",
                Version            = "1.1",
                Title              = "Standard",
                Level              = 4,
                Status             = "Approved for Delivery",
                TypicalDuration    = 12,
                TrailblazerContact = "Contact name",
                StandardPageUrl    = "www.standard.com",
                OverviewOfRole     = "Explanation of apprenticeship job role"
            };

            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1
            });
            OrganisationStandardHandler.InsertRecord(_organisationStandard);
            OrganisationStandardDeliveryAreaHandler.InsertRecords(new List <OrganisationStandardDeliveryAreaModel> {
                deliveryArea1, deliveryArea2
            });
            OrganisationStandardVersionHandler.InsertRecord(organistionStandardVersion1);
            OrganisationStandardVersionHandler.InsertRecord(organistionStandardVersion2);

            StandardsHandler.InsertRecords(new List <StandardModel> {
                standardModel1, standardModel2
            });
        }