public void SavePersistenceSettings_Execute() { //------------Setup for test-------------------------- var serializer = new Dev2JsonSerializer(); var workspaceMock = new Mock <IWorkspace>(); var settingsData = new PersistenceSettingsData { PersistenceScheduler = "Hangfire", Enable = true, PersistenceDataSource = new NamedGuidWithEncryptedPayload { Name = "Data Source", Value = Guid.Empty, Payload = "foo" }, EncryptDataSource = true, DashboardHostname = "DashboardHostname", DashboardName = "Dashboardname", DashboardPort = "5001", PrepareSchemaIfNecessary = true, ServerName = "servername" }; var requestArgs = new Dictionary <string, StringBuilder>(); requestArgs.Add("PersistenceSettings", new StringBuilder(serializer.SerializeToBuilder(settingsData).ToString())); var savePersistenceSettings = new SavePersistenceSettings(); //------------Execute Test--------------------------- var jsonResult = savePersistenceSettings.Execute(requestArgs, workspaceMock.Object); var result = serializer.Deserialize <ExecuteMessage>(jsonResult); //------------Assert Results------------------------- Assert.IsFalse(result.HasError); }
public void SavePersistenceSettings_Execute_nullValues_Fails() { //------------Setup for test-------------------------- var serializer = new Dev2JsonSerializer(); var savePersistenceSettings = new SavePersistenceSettings(); //------------Execute Test--------------------------- var jsonResult = savePersistenceSettings.Execute(null, null); var result = serializer.Deserialize <ExecuteMessage>(jsonResult); //------------Assert Results------------------------- Assert.IsTrue(result.HasError); }