예제 #1
0
        public void GetSubmissionChangeSummary_Detects_when_the_website_url_has_changed()
        {
            var testOldReturn = new Return {
                CompanyLinkToGPGInfo = "", Organisation = new Organisation {
                    SectorType = SectorTypes.Private
                }
            };

            var sharedBusinessLogic = UiTestHelper.DIContainer.Resolve <ISharedBusinessLogic>();

            // Mocks
            var testSubmissionService = new SubmissionService(sharedBusinessLogic, Mock.Of <ISubmissionBusinessLogic>(), Mock.Of <IScopeBusinessLogic>(), Mock.Of <IDraftFileBusinessLogic>());
            var testPresenter         = new SubmissionPresenter(testSubmissionService, ConfigHelpers.SubmissionOptions, null);

            // Copy the original
            var testNewReturn = (Return)testOldReturn.CopyProperties(new Return());

            // Make the change
            testNewReturn.CompanyLinkToGPGInfo = "http://unittesting";

            // Assert
            SubmissionChangeSummary testChangeSummary = testPresenter.GetSubmissionChangeSummary(testNewReturn, testOldReturn);
            string failMessage = $"Assert: Failed to detect {nameof(testNewReturn.CompanyLinkToGPGInfo)} had changed";

            Expect(testChangeSummary.HasChanged, failMessage);
            Expect(testChangeSummary.FiguresChanged == false, failMessage);
            Expect(testChangeSummary.OrganisationSizeChanged == false, failMessage);
            Expect(testChangeSummary.PersonResonsibleChanged == false, failMessage);
            Expect(testChangeSummary.WebsiteUrlChanged, failMessage);
        }
예제 #2
0
        public void GetSubmissionChangeSummary_Detects_no_changes()
        {
            var testOldReturn = new Return {
                DiffMeanBonusPercent        = 100,
                DiffMeanHourlyPayPercent    = 99,
                DiffMedianBonusPercent      = 98,
                DiffMedianHourlyPercent     = 97,
                FemaleLowerPayBand          = 96,
                FemaleMedianBonusPayPercent = 95,
                FemaleMiddlePayBand         = 94,
                FemaleUpperPayBand          = 93,
                FemaleUpperQuartilePayBand  = 92,
                MaleLowerPayBand            = 91,
                MaleMedianBonusPayPercent   = 90,
                MaleUpperQuartilePayBand    = 89,
                MaleMiddlePayBand           = 88,
                MaleUpperPayBand            = 87,
                FirstName            = "Test",
                LastName             = "User",
                JobTitle             = "QA",
                CompanyLinkToGPGInfo = "http://unittesting",
                MinEmployees         = 250,
                MaxEmployees         = 499,
                Organisation         = new Organisation {
                    SectorType = SectorTypes.Private
                }
            };

            var sharedBusinessLogic = UiTestHelper.DIContainer.Resolve <ISharedBusinessLogic>();

            // Mocks
            var testSubmissionService = new SubmissionService(sharedBusinessLogic, Mock.Of <ISubmissionBusinessLogic>(), Mock.Of <IScopeBusinessLogic>(), Mock.Of <IDraftFileBusinessLogic>());
            var testPresenter         = new SubmissionPresenter(testSubmissionService, ConfigHelpers.SubmissionOptions, null);

            // Copy the original
            var testNewReturn = (Return)testOldReturn.CopyProperties(new Return());

            // Assert
            SubmissionChangeSummary testChangeSummary = testPresenter.GetSubmissionChangeSummary(testNewReturn, testOldReturn);
            string failMessage = $"Assert: Failed to detect {nameof(testNewReturn.CompanyLinkToGPGInfo)} had changed";

            Expect(testChangeSummary.HasChanged == false, failMessage);
            Expect(testChangeSummary.FiguresChanged == false, failMessage);
            Expect(testChangeSummary.OrganisationSizeChanged == false, failMessage);
            Expect(testChangeSummary.PersonResonsibleChanged == false, failMessage);
            Expect(testChangeSummary.WebsiteUrlChanged == false, failMessage);
        }
예제 #3
0
        public void GetSubmissionChangeSummary_Detects_when_the_person_responsible_has_changed()
        {
            var testOldReturn = new Return {
                FirstName = "Test", LastName = "User", JobTitle = "QA", Organisation = new Organisation {
                    SectorType = SectorTypes.Private
                }
            };

            string[] personProps = { nameof(testOldReturn.FirstName), nameof(testOldReturn.LastName), nameof(testOldReturn.JobTitle) };

            var changeValue = "Mr T";

            var sharedBusinessLogic = UiTestHelper.DIContainer.Resolve <ISharedBusinessLogic>();

            // Mocks
            var testSubmissionService = new SubmissionService(sharedBusinessLogic, Mock.Of <ISubmissionBusinessLogic>(), Mock.Of <IScopeBusinessLogic>(), Mock.Of <IDraftFileBusinessLogic>());
            var testPresenter         = new SubmissionPresenter(testSubmissionService, ConfigHelpers.SubmissionOptions, null);

            // Assert all figures
            foreach (string personPropName in personProps)
            {
                // Restore the original
                var testNewReturn = (Return)testOldReturn.CopyProperties(new Return());

                // Make the change
                testNewReturn.SetProperty(personPropName, changeValue);

                // Assert
                SubmissionChangeSummary testChangeSummary = testPresenter.GetSubmissionChangeSummary(testNewReturn, testOldReturn);
                string failMessage = $"Assert: Failed to detect {personPropName} had changed";
                Expect(testChangeSummary.HasChanged, failMessage);
                Expect(testChangeSummary.FiguresChanged == false, failMessage);
                Expect(testChangeSummary.OrganisationSizeChanged == false, failMessage);
                Expect(testChangeSummary.PersonResonsibleChanged, failMessage);
                Expect(testChangeSummary.WebsiteUrlChanged == false, failMessage);
            }
        }
예제 #4
0
        public void GetSubmissionChangeSummary_Detects_when_the_figures_have_changed()
        {
            var testOldReturn = new Return {
                DiffMeanBonusPercent        = 100,
                DiffMeanHourlyPayPercent    = 99,
                DiffMedianBonusPercent      = 98,
                DiffMedianHourlyPercent     = 97,
                FemaleLowerPayBand          = 96,
                FemaleMedianBonusPayPercent = 95,
                FemaleMiddlePayBand         = 94,
                FemaleUpperPayBand          = 93,
                FemaleUpperQuartilePayBand  = 92,
                MaleLowerPayBand            = 91,
                MaleMedianBonusPayPercent   = 90,
                MaleUpperQuartilePayBand    = 89,
                MaleMiddlePayBand           = 88,
                MaleUpperPayBand            = 87,
                Organisation = new Organisation {
                    SectorType = SectorTypes.Private
                }
            };

            string[] figureProps =
            {
                nameof(testOldReturn.DiffMeanBonusPercent),
                nameof(testOldReturn.DiffMeanHourlyPayPercent),
                nameof(testOldReturn.DiffMedianBonusPercent),
                nameof(testOldReturn.DiffMedianHourlyPercent),
                nameof(testOldReturn.FemaleLowerPayBand),
                nameof(testOldReturn.FemaleMedianBonusPayPercent),
                nameof(testOldReturn.FemaleMiddlePayBand),
                nameof(testOldReturn.FemaleUpperPayBand),
                nameof(testOldReturn.FemaleUpperQuartilePayBand),
                nameof(testOldReturn.MaleLowerPayBand),
                nameof(testOldReturn.MaleMedianBonusPayPercent),
                nameof(testOldReturn.MaleUpperQuartilePayBand),
                nameof(testOldReturn.MaleMiddlePayBand),
                nameof(testOldReturn.MaleUpperPayBand)
            };

            decimal changeValue = 0;

            var sharedBusinessLogic = UiTestHelper.DIContainer.Resolve <ISharedBusinessLogic>();

            // Mocks
            var testSubmissionService = new SubmissionService(sharedBusinessLogic, Mock.Of <ISubmissionBusinessLogic>(), Mock.Of <IScopeBusinessLogic>(), Mock.Of <IDraftFileBusinessLogic>());
            var testPresenter         = new SubmissionPresenter(testSubmissionService, ConfigHelpers.SubmissionOptions, null);

            // Assert all figures
            foreach (string figurePropName in figureProps)
            {
                // Restore the original
                var testNewReturn = (Return)testOldReturn.CopyProperties(new Return());

                // Make the change
                testNewReturn.SetProperty(figurePropName, changeValue);

                // Assert
                SubmissionChangeSummary testChangeSummary = testPresenter.GetSubmissionChangeSummary(testNewReturn, testOldReturn);
                string failMessage = $"Assert: Failed to detect {figurePropName} had changed";
                Expect(testChangeSummary.HasChanged, failMessage);
                Expect(testChangeSummary.FiguresChanged, failMessage);
                Expect(testChangeSummary.OrganisationSizeChanged == false, failMessage);
                Expect(testChangeSummary.PersonResonsibleChanged == false, failMessage);
                Expect(testChangeSummary.WebsiteUrlChanged == false, failMessage);
            }
        }