Esempio n. 1
0
        public void Audit_log_checks_organisation_type_id_audit_is_as_expected(int previousOrgTypeId, int newOrgTypeId, bool?auditChangesMade)
        {
            var _organisationId = Guid.NewGuid();
            var username        = "******";

            _organisationRepository.Setup(x => x.GetLegalName(It.IsAny <Guid>())).ReturnsAsync("legal name");
            _organisationRepository.Setup(x => x.GetOrganisationType(It.IsAny <Guid>())).ReturnsAsync(previousOrgTypeId);
            _organisationRepository.Setup(x => x.GetOrganisationStatus(It.IsAny <Guid>())).ReturnsAsync(1);
            _organisationRepository.Setup(x => x.GetStartDate(It.IsAny <Guid>())).ReturnsAsync(DateTime.Today);
            _organisationRepository.Setup(x => x.GetApplicationDeterminedDate(It.IsAny <Guid>()))
            .ReturnsAsync(DateTime.Today);
            _lookupRepository.Setup(x => x.GetProviderTypes()).ReturnsAsync(new List <ProviderType>());
            _organisationStatusManager.Setup(x =>
                                             x.ShouldChangeStatustoActiveAndSetStartDateToToday(It.IsAny <int>(), It.IsAny <int>(),
                                                                                                It.IsAny <int>()))
            .Returns(true);
            var auditLogService = new AuditLogService(_settings, _organisationRepository.Object, _lookupRepository.Object, _organisationStatusManager.Object);
            var auditData       = auditLogService.AuditOrganisation(new UpdateOrganisationCommand {
                LegalName = "legal name", OrganisationId = _organisationId, Username = username, OrganisationTypeId = newOrgTypeId, ApplicationDeterminedDate = DateTime.Today
            });

            Assert.AreEqual(auditChangesMade, auditData?.ChangesMade);
        }