public void TestOnCreateApplication() { bool success = true; string solutionName = "Solution" + Guid.NewGuid(); var mockAuditLog = new Mock <IAuditLog>(MockBehavior.Strict); mockAuditLog.Setup(al => al.OnCreateApplication(success, solutionName)); var eventTarget = new AuditLogSolutionEventTarget(mockAuditLog.Object); var solution = new Solution { Name = solutionName }; IDictionary <string, object> state = new Dictionary <string, object>(); eventTarget.GatherAuditLogEntityDetailsForSave(solution, state); eventTarget.WriteSaveAuditLogEntries(success, solution.Id, state); mockAuditLog.VerifyAll(); }
/// <summary> /// Called before saving the enumeration of entities. /// </summary> /// <param name="entities">The entities.</param> /// <param name="state">The state passed between the before save and after save callbacks.</param> /// <returns> /// True to cancel the save operation; false otherwise. /// </returns> public bool OnBeforeSave(IEnumerable <IEntity> entities, IDictionary <string, object> state) { var enableAppLockdown = !Factory.FeatureSwitch.Get("disableAppLockdown"); foreach (Solution solution in entities.Select(e => e.As <Solution>())) { AssignPackageId(solution); _auditLogEventTarget.GatherAuditLogEntityDetailsForSave(solution, state); if (enableAppLockdown) { EnsureNotRemovingProtectedEntitiesFromSolution(solution); } ValidateSolutionVersion(solution); TrackNewSolutions(state, solution); MakeNewSolutionModifiable(solution); } return(false); }