public void GetVersions_Execute_ExpectSuccess_NonDbType() { //------------Setup for test-------------------------- var getVersions = new GetVersion(); var resourceId = Guid.NewGuid(); var versionId = Guid.NewGuid(); //var wsId = Guid.NewGuid(); var ws = new Mock <IWorkspace>(); var version = new VersionInfo(DateTime.Now, "bob", "dave", "2", resourceId, versionId); var mockRes = new Mock <IResource>(); var servVer = new Mock <IServerVersionRepository>(); servVer.Setup(a => a.GetVersion(It.IsAny <VersionInfo>(), It.IsAny <string>())).Returns(new StringBuilder(resourceOne)); mockRes.Setup(a => a.ResourceType).Returns("WorkflowService"); var cat = new Mock <IResourceCatalog>(); cat.Setup(a => a.GetResource(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(mockRes.Object); var serializer = new Dev2JsonSerializer(); ws.Setup(a => a.ID).Returns(Guid.Empty); getVersions.ServerVersionRepo = servVer.Object; getVersions.ResourceCatalog = cat.Object; var serialisr = new Dev2JsonSerializer(); //------------Execute Test--------------------------- var ax = getVersions.Execute(new Dictionary <string, StringBuilder> { { "versionInfo", serialisr.SerializeToBuilder(version) } }, ws.Object); //------------Assert Results------------------------- var ver = serializer.Deserialize <ExecuteMessage>(ax.ToString()); Assert.AreEqual(ExpectedModifiedVersion, ver.Message.ToString()); }
public bool UnloadDriver() { if (!_driverLoaded) { return(true); } IntPtr procAddress = GetProcAddress(_helperLib, "Version"); GetVersion ver = (GetVersion)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(GetVersion)); int realVersion = ver(); bool result; // register driver procAddress = GetProcAddress(_helperLib, "StopDriver"); StopDriver stop = (StopDriver)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(StopDriver)); result = stop("pmem"); if (result == false) { return(result); } // start driver procAddress = GetProcAddress(_helperLib, "UnregisterDriver"); UnregisterDriver unreg = (UnregisterDriver)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(UnregisterDriver)); result = unreg("pmem"); _driverLoaded = false; return(result); }
public void GetVersion(GetVersion task) { var outputType = typeof(GetVersion); foreach (var variable in versionVariables) { outputType.GetProperty(variable.Key)?.SetValue(task, variable.Value, null); } }
public void GetVersion(GetVersion task) { gitVersionCalculator.TryCalculateVersionVariables(out var versionVariables); var outputType = typeof(GetVersion); foreach (var variable in versionVariables) { outputType.GetProperty(variable.Key)?.SetValue(task, variable.Value, null); } }
public void GetVersions_Execute_ExpectException_NoArgs() { //------------Setup for test-------------------------- var getVersions = new GetVersion(); var serialiser = new Dev2JsonSerializer(); //------------Execute Test--------------------------- var ax = getVersions.Execute(new Dictionary <string, StringBuilder>(), new Workspace(Guid.NewGuid())); Assert.AreEqual(ExecStatus.Fail, serialiser.Deserialize <ExplorerRepositoryResult>(ax).Status); }
public void GetVersion(GetVersion task) { var versionVariables = VersionVariables.FromFile(task.VersionFile, fileSystem, log); var outputType = typeof(GetVersion); foreach (var variable in versionVariables) { outputType.GetProperty(variable.Key)?.SetValue(task, variable.Value, null); } }
public void GetResourceID_ShouldReturnEmptyGuid() { //------------Setup for test-------------------------- var getVersion = new GetVersion(); //------------Execute Test--------------------------- var resId = getVersion.GetResourceID(new Dictionary <string, StringBuilder>()); //------------Assert Results------------------------- Assert.AreEqual(Guid.Empty, resId); }
public void GetAuthorizationContextForService_ShouldReturnContext() { //------------Setup for test-------------------------- var getVersion = new GetVersion(); //------------Execute Test--------------------------- var resId = getVersion.GetAuthorizationContextForService(); //------------Assert Results------------------------- Assert.AreEqual(AuthorizationContext.Any, resId); }
public void GetVersions_HandlesType_ExpectName() { //------------Setup for test-------------------------- var getVersions = new GetVersion(); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual("GetVersion", getVersions.HandlesType()); }
public void GetVersions_CreateServiceEntry_ExpectProperlyFormedDynamicService() { //------------Setup for test-------------------------- var getVersion = new GetVersion(); //------------Execute Test--------------------------- var a = getVersion.CreateServiceEntry(); //------------Assert Results------------------------- var b = a.DataListSpecification.ToString(); Assert.AreEqual(@"<DataList><ResourceID ColumnIODirection=""Input""/><Dev2System.ManagmentServicePayload ColumnIODirection=""Both""></Dev2System.ManagmentServicePayload></DataList>", b); }
public void Dispose() { if (TableExists != null) { TableExists.Dispose(); TableExists = null; } if (GetVersion != null) { GetVersion.Dispose(); GetVersion = null; } if (CreateSchema != null) { CreateSchema.Dispose(); CreateSchema = null; } if (UpsertObject != null) { UpsertObject.Dispose(); UpsertObject = null; } if (GetObject != null) { GetObject.Dispose(); GetObject = null; } if (QueryObjects != null) { QueryObjects.Dispose(); QueryObjects = null; } if (UpdateObject != null) { UpdateObject.Dispose(); UpdateObject = null; } if (GetQueuedRefreshes != null) { GetQueuedRefreshes.Dispose(); GetQueuedRefreshes = null; } }
public static Task SetNewVersion() { return(new Task(() => { var newVersion = GetVersion.GetNewVersion(); if (Convert.ToInt16(newVersion.VersionCode) <= Convert.ToInt16(Blt)) { return; } Ver = newVersion.Version; Blt = newVersion.VersionCode; ApkDownloadPath = newVersion.DownloadPath; })); }
public void GetVersionTaskShouldReturnVersionOutputVariablesForBuildServer() { var task = new GetVersion(); using var result = ExecuteMsBuildTaskInAzurePipeline(task); result.Success.ShouldBe(true); result.Errors.ShouldBe(0); result.Task.Major.ShouldBe("1"); result.Task.Minor.ShouldBe("0"); result.Task.Patch.ShouldBe("1"); result.Task.MajorMinorPatch.ShouldBe("1.0.1"); result.Task.FullSemVer.ShouldBe("1.0.1+1"); }
public void GetVersionTaskShouldReturnVersionOutputVariables() { var task = new GetVersion(); using var result = ExecuteMsBuildTask(task); result.Success.ShouldBe(true); result.Errors.ShouldBe(0); result.Task.Major.ShouldBe("1"); result.Task.Minor.ShouldBe("2"); result.Task.Patch.ShouldBe("4"); result.Task.MajorMinorPatch.ShouldBe("1.2.4"); result.Task.FullSemVer.ShouldBe("1.2.4+1"); }
public void ParseVersion() { const string GoodVersionString = "3.0.0.0"; var goodVersion = new Version("3.0.0.0"); const string BadVersionString = "asdf"; Version result = null; Assert.DoesNotThrow(() => result = new GetVersion().ParseVersion(GoodVersionString)); Assert.AreEqual(goodVersion, result); Assert.Throws <ArgumentException>(() => result = new GetVersion().ParseVersion(BadVersionString)); }
public void GetVersionTaskShouldReturnVersionOutputVariablesForBuildServer() { using var fixture = CreateRemoteRepositoryFixture(); var task = new GetVersion { SolutionDirectory = fixture.LocalRepositoryFixture.RepositoryPath, }; var result = ExecuteMsBuildTaskInBuildServer(task); result.Success.ShouldBe(true); result.Errors.ShouldBe(0); result.Task.FullSemVer.ShouldBe("1.0.1+1"); }
private void ProcessCommand(string command) { _commandHistory.Add(command); switch (command.ToLower().Split(' ')[1]) { case "version": var parts = command.ToLower().Split(' '); if (parts.Length == 2) { var versionList = GetVersion.Version(); DisplayVersion(versionList); } else if (parts.Length > 2) { var versionList = GetVersion.Version(command.ToLower().Split()[2]); DisplayFullVersion(versionList); } break; case "teletype": _useTeleType = !_useTeleType; // Toggle Teletype mode DisplayText("Teletype mode = " + _useTeleType.ToString()); break; default: parts = command.ToLower().Split(' '); if (string.IsNullOrEmpty(parts[1])) { DisplayText(""); } else { DisplayText(command.ToLower().Split(' ')[1].ToUpperInvariant() + " is not a recognized command"); } break; } }
protected async Task CallGetVersionServiceCore(JsonServer js, JsonClient jc, ICredentials credentials = null) { // event handlers var connected = 0; var disconnected = 0; js.ClientConnected += (s, e) => connected++; js.ClientDisconnected += (s, e) => disconnected++; js.UnhandledException += (s, e) => Assert.Fail($"Unhandled server exception: {e.Exception}. Connected: {connected}, disconnected: {disconnected}."); jc.UnhandledException += (s, e) => Assert.Fail($"Unhandled client exception: {e.Exception}. Connected: {connected}, disconnected: {disconnected}."); // start json server and connect the client js.Start(); Assert.IsNull(jc.SessionId); var sessionId = await jc.ConnectAsync(credentials); Assert.IsNotNull(jc.SessionId); Assert.AreEqual(sessionId, jc.SessionId); // call GetVersion var msg = new GetVersion(); var result = await Assert_NotTimedOut(jc.Call(msg), "jc.Call(msg)"); Assert.NotNull(result); Assert.AreEqual("0.01-alpha", result.Version); // call GetVersion msg = new GetVersion { IsInternal = true }; result = await Assert_NotTimedOut(jc.Call(msg), "jc.Call(msg...IsInternal)"); Assert.NotNull(result); Assert.AreEqual("Version 0.01-alpha, build 12345, by yallie", result.Version); // make sure all incoming messages are processed Assert.AreEqual(0, jc.PendingMessages.Count); }
public bool LoadDriverEx() { if (_driverLoaded) { return(true); } //uint error = GetLastError(); IntPtr procAddress = GetProcAddress(_helperLib, "Version"); GetVersion ver = (GetVersion)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(GetVersion)); _driverVersion = ver(); bool result; // register driver procAddress = GetProcAddress(_helperLib, "RegisterDriver"); RegisterDriver reg = (RegisterDriver)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(RegisterDriver)); result = reg("pmem", _driverFilename); if (result == false) { _driverLoaded = false; return(result); } // start driver procAddress = GetProcAddress(_helperLib, "StartDriver"); StartDriver start = (StartDriver)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(StartDriver)); result = start("pmem"); if (result == false) { _driverLoaded = false; return(result); } //error = GetLastError(); _driverLoaded = true; return(result); }
/// <summary> /// 更新按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_update_MouseClick(object sender, DuiMouseEventArgs e) { GetVersion gv = new GetVersion(); Entity.VerEntity cv = gv.getVer(); pes.pes.UpdateContent = cv.Content; pes.pes.DownloadUrl = cv.DownloadUrl; if (!lb_ver.Text.Equals(cv.Ver)) { UpdateProperts upConfig = new UpdateProperts(); upConfig.VerNo = cv.Ver; upConfig.BackColor = pes.pes.BackColor; upConfig.BackImg = pes.pes.BackImg; upConfig.DownloadUrl = cv.DownloadUrl; upConfig.UpdateContent = cv.Content; upConfig.MainApplicationName = System.IO.Path.GetFileName(Application.ExecutablePath).Replace(".exe", ""); upConfig.saveConfig(); //调用更新窗体 Process myProcess = new Process(); myProcess.StartInfo.UseShellExecute = false; myProcess.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + @"\AppUpdate.exe"; myProcess.StartInfo.CreateNoWindow = true; myProcess.Start(); //关闭程序 Dispose(); Close(); System.Environment.Exit(0); } else { //提示不需要更新 string messageStr = lb_ver.Text + "已是最新版本,无需更新!"; MessageForm mf = new MessageForm(messageStr); mf.Show(); } }
public void SearchMatch() { string SummonerName = ""; string Region = ""; int MenuListCount = 0; TextBoxSummonerName.Invoke(new MethodInvoker(delegate { SummonerName = TextBoxSummonerName.Text; })); regionsComboBox.Invoke(new MethodInvoker(delegate { Region = regionsComboBox.Text; })); VersionClass ver = GetVersion.ReturnVersion(Region, apiKey); version = ver.n.champion; this.Invoke((MethodInvoker) delegate { MenuListCount = MenuControls.Count; }); try { for (int a = 0; a < MenuListCount; a++) { SetControlPropertyThreadSafe(MenuControls[a], "Enabled", false); } SummonerInfo summonerInfo = GetSummoner.ReturnSummoner(SummonerName, Region, apiKey); MatchInfo = MatchSearch.GetMatch(Region, summonerInfo.id, apiKey); string[] Keys = MatchSearch.GetKeys(JSON, MatchInfo); string[] Names = MatchSearch.GetName(JSON, MatchInfo); SetControlPropertyThreadSafe(Summoner1, "Text", MatchInfo.participants[0].summonerName); SetControlPropertyThreadSafe(Summoner2, "Text", MatchInfo.participants[1].summonerName); SetControlPropertyThreadSafe(Summoner3, "Text", MatchInfo.participants[2].summonerName); SetControlPropertyThreadSafe(Summoner4, "Text", MatchInfo.participants[3].summonerName); SetControlPropertyThreadSafe(Summoner5, "Text", MatchInfo.participants[4].summonerName); SetControlPropertyThreadSafe(Summoner6, "Text", MatchInfo.participants[5].summonerName); SetControlPropertyThreadSafe(Summoner7, "Text", MatchInfo.participants[6].summonerName); SetControlPropertyThreadSafe(Summoner8, "Text", MatchInfo.participants[7].summonerName); SetControlPropertyThreadSafe(Summoner9, "Text", MatchInfo.participants[8].summonerName); SetControlPropertyThreadSafe(Summoner10, "Text", MatchInfo.participants[9].summonerName); PictureBox[] pb = new PictureBox[10] { TeamMatePictureBox0, TeamMatePictureBox1, TeamMatePictureBox2, TeamMatePictureBox3, TeamMatePictureBox4, TeamMatePictureBox5, TeamMatePictureBox6, TeamMatePictureBox7, TeamMatePictureBox8, TeamMatePictureBox9 }; for (int i = 0; i < 10; i++) { pb[i].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/champion/" + Keys[i] + ".png"); this.Invoke((MethodInvoker) delegate { LoLToolTip.SetToolTip(pb[i], Names[i]); }); } if (MatchInfo.gameQueueConfigId == 4 || MatchInfo.gameQueueConfigId == 6 || MatchInfo.gameQueueConfigId == 9 || MatchInfo.gameQueueConfigId == 41 || MatchInfo.gameQueueConfigId == 42) { PictureBox[] pbBans = new PictureBox[6] { banPB1, banPB2, banPB3, banPB4, banPB5, banPB6 }; for (int i = 10; i < Keys.Length; i++) { pbBans[i - 10].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/champion/" + Keys[i] + ".png"); this.Invoke((MethodInvoker) delegate { LoLToolTip.SetToolTip(pbBans[i - 10], Names[i]); }); } } PictureBox[] summonerSpell_1 = new PictureBox[10] { Summoner1Spell1, Summoner2Spell1, Summoner3Spell1, Summoner4Spell1, Summoner5Spell1, Summoner6Spell1, Summoner7Spell1, Summoner8Spell1, Summoner9Spell1, Summoner10Spell1 }; PictureBox[] summonerSpell_2 = new PictureBox[10] { Summoner1Spell2, Summoner2Spell2, Summoner3Spell2, Summoner4Spell2, Summoner5Spell2, Summoner6Spell2, Summoner7Spell2, Summoner8Spell2, Summoner9Spell2, Summoner10Spell2 }; List <Spells> summonerSpell = SummonerSpells.GetSpells(Region, apiKey); int x = 0; string[] SummID = new string[10]; foreach (Participant part in MatchInfo.participants) { SummID[x] = part.summonerId.ToString(); foreach (var item in summonerSpell) { if (item.Id == part.spell1Id) { summonerSpell_1[x].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + item.Key + ".png"); this.Invoke((MethodInvoker) delegate { LoLToolTip.SetToolTip(summonerSpell_1[x], item.Name); }); } if (item.Id == part.spell2Id) { summonerSpell_2[x].Load("http://ddragon.leagueoflegends.com/cdn/" + version + "/img/spell/" + item.Key + ".png"); this.Invoke((MethodInvoker) delegate { LoLToolTip.SetToolTip(summonerSpell_2[x], item.Name); }); } } x++; } PictureBox[] DivisionsPB = new PictureBox[10] { divPb1, divPB2, divPB3, divPB4, divPB5, divPB6, divPB7, divPB8, divPB9, divPB10 }; Label[] divLabels = new Label[10] { DivString1, DivString2, DivString3, DivString4, DivString5, DivString6, DivString7, DivString8, DivString9, DivString10 }; ReturnDivision divisionsImages = ReturnDivisionInfo.GetDivisions(Region, apiKey, SummID); for (int i = 0; i < divisionsImages.divList.Count(); i++) { SetControlPropertyThreadSafe(divLabels[i], "Text", divisionsImages.divList[i].Division); SetControlPropertyThreadSafe(DivisionsPB[i], "Image", divisionsImages.image[i]); this.Invoke((MethodInvoker) delegate { LoLToolTip.SetToolTip((Control)DivisionsPB[i], divisionsImages.divList[i].Name); }); } //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// SetControlPropertyThreadSafe(LoadCircle, "Visible", false); for (int a = 0; a < MenuListCount; a++) { SetControlPropertyThreadSafe(MenuControls[a], "Enabled", true); } this.Invoke((MethodInvoker) delegate { basicPage.Hide(); FIVEvsFIVEpanel.Show(); FIVEvsFIVEpanel.BringToFront(); }); } catch (WebException ex) { MessageBox.Show(ex.ToString()); if (ex.Status == WebExceptionStatus.ProtocolError) { var response = (HttpWebResponse)ex.Response; if (response.StatusCode == HttpStatusCode.NotFound) { SetControlPropertyThreadSafe(MessageLabel, "Visible", true); SetControlPropertyThreadSafe(MessageLabel, "Text", "The summoner " + SummonerName + " is not currently in a game!"); this.Invoke((MethodInvoker) delegate { emptyTextBoxControlTimer.Enabled = true; }); SetControlPropertyThreadSafe(LoadCircle, "Visible", false); for (int a = 0; a < MenuListCount; a++) { SetControlPropertyThreadSafe(MenuControls[a], "Enabled", true); } } } for (int a = 0; a < MenuListCount; a++) { SetControlPropertyThreadSafe(MenuControls[a], "Enabled", true); } SetControlPropertyThreadSafe(LoadCircle, "Visible", false); } }
public static IProcessBase GetProcessByMethod(IBrowserBase formBrowser, ParamModel paramModel) { var process = new GetVersion(formBrowser, paramModel); return((IProcessBase)process); }
private async Task <string> Execute(GetVersion msg) { var result = await(Executor.Execute(GetVersionName, msg) as Task <GetVersionResponse>); return(result.Version); }
public static bool GetVersion(GetVersion task) => ExecuteGitVersionTask(task, executor => executor.GetVersion(task));