public void SecurityCodeBusinessLogic_ExpireSecurityCode_Succeeds()
        {
            // Arrange
            var securityCodeBusinessLogic = new SecurityCodeBusinessLogic();
            var organisation = new Organisation();

            organisation.SetSecurityCode(VirtualDateTime.Now.AddDays(1));

            // Act
            var creationResult = securityCodeBusinessLogic.ExpireSecurityCode(organisation);

            Assert.True(creationResult.Succeeded);

            var modifiedOrganisation = creationResult.Result;

            // Assert
            Assert.NotNull(modifiedOrganisation.SecurityCode);
            Assert.AreEqual(
                VirtualDateTime.Now.AddDays(-1).ToString("dd/MM/yyyy"),
                modifiedOrganisation.SecurityCodeExpiryDateTime?.ToString("dd/MM/yyyy"),
                "Security codes are expired by changing their expiry date to yesterday");
            Assert.NotNull(modifiedOrganisation.SecurityCodeCreatedDateTime);
        }
        public void SecurityCodeBusinessLogic_ExpireSecurityCode_Cannot_Expire_An_Already_Expired_Organisation()
        {
            // Arrange
            var securityCodeBusinessLogic = new SecurityCodeBusinessLogic();
            var organisation = new Organisation {
                OrganisationId = 123456789
            };

            organisation.SetSecurityCode(VirtualDateTime.Now.AddDays(1));
            organisation.SetSecurityCodeExpiryDate(VirtualDateTime.Now.AddDays(-1));

            // Act
            var creationResult = securityCodeBusinessLogic.ExpireSecurityCode(organisation);

            // Assert
            Assert.True(creationResult.Failed);
            Assert.AreEqual(
                "Cannot modify the security code information of an already expired security code",
                creationResult.ErrorMessage.Description);
            Assert.AreEqual(4004, creationResult.ErrorMessage.Code);
            Assert.Null(creationResult.Result);
            Assert.AreEqual(123456789, creationResult.ErrorRelatedObject.OrganisationId);
        }