public void LoadSearchDataIntoCache_DoesNotInclude_RetiredOrganisationsInScope()
        {
            // Arrange
            var retiredOrganisationInScope = new Organisation
            {
                OrganisationId     = 1,
                OrganisationName   = "Test organisation",
                SectorType         = SectorTypes.Private,
                Status             = OrganisationStatuses.Retired,
                OrganisationScopes = new List <OrganisationScope>
                {
                    new OrganisationScope {
                        Status = ScopeRowStatuses.Active, ScopeStatus = ScopeStatuses.InScope
                    }
                }
            };

            Global.ContainerIoC = UiTestHelper.BuildContainerIoC(retiredOrganisationInScope);

            // Act
            SearchRepository.LoadSearchDataIntoCache();

            // Assert
            AssertOrganisationIsNotIncludedInViewingService(retiredOrganisationInScope);
        }
        public void LoadSearchDataIntoCache_Includes_ActiveOrganisationsWithDraftReports()
        {
            // Arrange
            var activeOrganisationWithDraftReports = new Organisation
            {
                OrganisationId   = 1,
                OrganisationName = "Test organisation",
                SectorType       = SectorTypes.Private,
                Status           = OrganisationStatuses.Active,
                Returns          = new List <Return> {
                    new Return {
                        Status = ReturnStatuses.Draft
                    }
                },
                OrganisationScopes = new List <OrganisationScope>
                {
                    new OrganisationScope {
                        Status = ScopeRowStatuses.Active, ScopeStatus = ScopeStatuses.PresumedInScope
                    }
                }
            };

            Global.ContainerIoC = UiTestHelper.BuildContainerIoC(activeOrganisationWithDraftReports);

            // Act
            SearchRepository.LoadSearchDataIntoCache();

            // Assert
            AssertOrganisationIsIncludedInViewingService(activeOrganisationWithDraftReports);
        }
        public void LoadSearchDataIntoCache_DoesNotInclude_RetiredOrganisationsWithNoReports()
        {
            // Arrange
            var retiredOrganisationWithNoSubmittedReports = new Organisation
            {
                OrganisationId   = 1,
                OrganisationName = "Test organisation",
                SectorType       = SectorTypes.Private,
                Status           = OrganisationStatuses.Retired
            };

            Global.ContainerIoC = UiTestHelper.BuildContainerIoC(retiredOrganisationWithNoSubmittedReports);

            // Act
            SearchRepository.LoadSearchDataIntoCache();

            // Assert
            AssertOrganisationIsNotIncludedInViewingService(retiredOrganisationWithNoSubmittedReports);
        }
        public void LoadSearchDataIntoCache_DoesNotInclude_DeletedOrganisations()
        {
            // Arrange
            var deletedOrganisation = new Organisation
            {
                OrganisationId   = 1,
                OrganisationName = "Test organisation",
                SectorType       = SectorTypes.Private,
                Status           = OrganisationStatuses.Deleted,
                Returns          = new List <Return> {
                    new Return {
                        Status = ReturnStatuses.Submitted
                    }
                }
            };

            Global.ContainerIoC = UiTestHelper.BuildContainerIoC(deletedOrganisation);

            // Act
            SearchRepository.LoadSearchDataIntoCache();

            // Assert
            AssertOrganisationIsNotIncludedInViewingService(deletedOrganisation);
        }
 public void WarmUpTests()
 {
     IocContainer = UiTestHelper.BuildContainerIoC();
 }