public void view_OnSendCollection(object sender, RequestCollectionEvenArgs e) { OnRequestCollectionCalled = true; try { if (e == null || e.Server == null || e.Target == null) { view.ShowErrorMessage(Resource.InvalidConfiguration); return; } var guid = (GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), true)[0]; var clientId = System.Environment.MachineName + "\\" + guid.Value; string prefix = String.Empty; if (!String.IsNullOrEmpty(e.Server.Address)) { prefix = (e.Server.Address.StartsWith("http")) ? String.Empty : "http://"; } var address = String.Format("{2}{0}:{1}/CollectService", e.Server.Address, e.Server.Port, prefix); modSicConnection = new ModSicConnection(address, e.Server.Username, e.Server.Password, clientId); systemCharacteristicsFilename = Path.Combine(e.SaveFolder, "system-characteristics.xml"); resultsFilename = Path.Combine(e.SaveFolder, "results.xml"); htmlFilename = Path.Combine(e.SaveFolder, "results.html"); StartThread(e); } catch (Exception ex) { view.ShowErrorMessage(Util.FormatExceptionMessage(ex)); } }
public IEnumerable <String> Execute(CollectServerParameters server) { var api = new ModSicConnection(server.Address, server.Username, server.Password, server.ClientId); var collectionsInExecution = api.GetCollectionsInExecution(); return(collectionsInExecution.Select(collectInfo => collectInfo.CollectRequestId)); }
public ModSicService(CollectServerParameters modSicServerParameters) { CreateStatusCharArray(); this._modSicConnection = new ModSicConnection( modSicServerParameters.Address, modSicServerParameters.Username, modSicServerParameters.Password, modSicServerParameters.ClientId); }
public void When_using_production_constructor_a_proxy_for_modsicService_must_be_created() { var modsicAPI = new ModSicConnection("https://localhost:1000/CollectService"); Assert.IsNotNull(modsicAPI.ModSicProxyService, "A proxy for modSIC Service must be initialized."); }
/// <summary> /// Only for unit tests purposes /// </summary> /// <param name="connectionMock">An instance of ModSicConnection with mock behavior.</param> public ModSicService(ModSicConnection connectionMock) { CreateStatusCharArray(); this._modSicConnection = connectionMock; }