public void tear_down()
 {
     OrganisationHandler.DeleteAllRecords();
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId1);
     ProviderTypeHandler.DeleteAllRecords();
     OrganisationStatusHandler.DeleteAllRecords();
 }
Beispiel #2
0
 public void Tear_down()
 {
     OrganisationHandler.DeleteAllRecords();
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId1);
     ProviderTypeHandler.DeleteAllRecords();
     OrganisationStatusHandler.DeleteRecords(new List <int> {
         _status1.Id
     });
 }
Beispiel #3
0
        public void ExpectedLatestDateIsReturnedWithUpdatedTakingPrecedence(DateTime createdDate, DateTime?updatedDate,
                                                                            DateTime previousCreatedDate, DateTime?previousUpdatedDate,
                                                                            DateTime expectedLatestDate, int organisationStatusId)
        {
            var expectedLatest = updatedDate ?? createdDate;

            if (organisationStatusId == 3)
            {
                expectedLatest = previousUpdatedDate ?? previousCreatedDate;
            }

            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = organisationStatusId,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = _legalName,
                Id        = _organisationId,
                CreatedAt = createdDate,
                UpdatedAt = updatedDate,
                CreatedBy = "Test"
            };


            var _organisationOld = new OrganisationModel
            {
                UKPRN = _organisationUkprn2,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = OrganisationStatusHandler.Active,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = _legalName,
                Id        = _organisationId2,
                CreatedAt = previousCreatedDate,
                UpdatedAt = previousUpdatedDate,
                CreatedBy = "Test"
            };

            OrganisationHandler.InsertRecord(_organisation);
            OrganisationHandler.InsertRecord(_organisationOld);
            var latestDate = _repository.GetLatestNonOnboardingOrganisationChangeDate().Result;

            Assert.AreEqual(expectedLatest.ToString("F"), latestDate.Value.ToString("F"));
            OrganisationHandler.DeleteAllRecords();
        }
        public void ExpectedLatestDateIsReturnedWithUpdatedTakingPrecedence(int secondOrganisationStatusId, int recordsExpected, string testDescription)
        {
            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = secondOrganisationStatusId,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = _legalName,
                Id        = _organisationId,
                CreatedAt = DateTime.Now,
                UpdatedAt = null,
                CreatedBy = "Test"
            };


            var organisation2 = new OrganisationModel
            {
                UKPRN = _organisationUkprn2,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = OrganisationStatusHandler.Active,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = _legalName,
                Id        = _organisationId2,
                CreatedAt = DateTime.Now.AddDays(-1),
                UpdatedAt = DateTime.Now,
                CreatedBy = "Test"
            };

            OrganisationHandler.InsertRecord(_organisation);
            OrganisationHandler.InsertRecord(organisation2);
            var registerDetails = _repository.GetRoatpSummary().Result;

            Assert.AreEqual(recordsExpected, registerDetails.Count());
            OrganisationHandler.DeleteAllRecords();
        }
Beispiel #5
0
        public void SetupOrganisationTests()
        {
            _repository      = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationId1 = "EPA00010";
            _organisationId2 = "EPA0050";
            _organisationId3 = "EPA0060";
            _organisationId4 = "EPA0075";
            _ukprn1          = 876544;
            _organisation1   = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = _ukprn1,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisation2 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 2",
                EndPointAssessorOrganisationId = _organisationId2,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisation3 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "companyNumber 3",
                EndPointAssessorOrganisationId = _organisationId3,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = "{\"LegalName\":\"City and Guilds(London / ILM)\",\"CompanyNumber\":\"" + "companyNumber 3" + "\",\"CharityNumber\":\"10009931\"}"
            };

            _organisation4 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "companyNumber 4",
                EndPointAssessorOrganisationId = _organisationId4,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = "{\"LegalName\":\"City and Guilds(London / ILM)\",\"CompanyNumber\":\"1234\",\"CharityNumber\":\"charity 4\"}"
            };

            OrganisationHandler.DeleteAllRecords();
            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1, _organisation2, _organisation3, _organisation4
            });
        }