public static int Main() { try { Console.WriteLine("Testing .cctor() invocation by calling instance method"); Console.WriteLine(); Console.WriteLine("Before calling instance method"); if (measure.a != 0xCC) { Console.WriteLine("in Main(), measure.a is {0}", measure.a); Console.WriteLine("FAILED"); return 1; } test t = new test(); Console.WriteLine("After calling instance method"); if (measure.a != 8) { Console.WriteLine("in Main() after new test(), measure.a is {0}", measure.a); Console.WriteLine("FAILED"); return -1; } } catch (Exception e) { Console.WriteLine(e.StackTrace); Console.WriteLine(); Console.WriteLine("PASSED"); return 100; } return -1; }
//O ../ significa voltar no diretório ....fiz a função em C++ talvez podemos usar isso para buscas. //[DllImport("../../Reader/bin/debug/Reader.dll")] //private static extern int main(); static void Main(string[] args) { // main(); test u = new test("joseh", 12, 1.50); u.addElement(); //DBFormatter bformatter = new DBFormatter(); //bformatter.Serialize(u); //Stream streamr = File.Open("test", FileMode.Open, FileAccess.Read, FileShare.None); //DBFormatter bformatter = new DBFormatter(); //Guid guid = new Guid("5ca72477-2a44-4177-8d13-609259a5453b"); //object k = bformatter.Deserialize(streamr, guid); //if (k != null) //{ // test p = (test)k; // Console.WriteLine("nome: " + p.Nome); // Console.WriteLine("idade: " + p.Idade); // foreach (var s in p.Lista) // { // test2 t = (test2)s; // Console.WriteLine(t.Nome); // } // Console.ReadKey(); //} DataBase db = new DataBase(); db.CreateDataBase("teste"); db.UseDataBase("teste"); db.Insert(u); }
public static int Main() { try { Console.WriteLine("Testing .cctor() invocation by calling instance method"); Console.WriteLine(); Console.WriteLine("Before calling instance method"); // .cctor should not run yet if (measure.a != 0xCC) { Console.WriteLine("in Main(), measure.a is {0}", measure.a); Console.WriteLine("FAILED"); return 1; } // the next line should trigger .cctor because .ctor is an instance method test t = new test(); Console.WriteLine("After calling instance method"); if (measure.a != 8) { Console.WriteLine("in Main() after new test(), measure.a is {0}", measure.a); Console.WriteLine("FAILED"); return -1; } } catch (Exception e) { Console.WriteLine(e.StackTrace); return -1; } Console.WriteLine(); Console.WriteLine("PASSED"); return 100; }
public static int Main() { test a = new test(); a.v1 = 5; Console.WriteLine (a.GetHashCode ()); X b = new X(); X c = new X(); Console.WriteLine (b.GetHashCode ()); Console.WriteLine (c.GetHashCode ()); return 0; }
// Use this for initialization void Start() { GameObject G = GameObject.FindGameObjectWithTag ("GameController"); gm = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameManager> (); T = G.GetComponent<test> (); enemy = gameObject; }
// Use this for initialization void Start() { text = GameObject.Find ("Canvas/Text").GetComponent<Text> (); Test = new test (); //test.createClient (); }
public static int Main(String[] args) { test t = new test(); if (t.str != null) Console.WriteLine("Got String"); return 100; }
public void TestCountReturnsCorrectValuesForMultiParameterMethod() { var t = new test(); var mock = new Mirror<ITest>(); mock.It.DoStuff(t, "a"); mock.It.DoStuff(t, "b"); mock.It.DoStuff(null, "a"); mock.It.DoStuff(t, "a"); mock.It.DoStuff(null, "a"); Assert.AreEqual(2, mock.Count(s => s.DoStuff(t, "a"))); Assert.AreEqual(1, mock.Count(s => s.DoStuff(t, "b"))); Assert.AreEqual(2, mock.Count(s => s.DoStuff(null, "a"))); }
// this function MUST exist // returns void or ClassType private static ClassType Setup(test obj) { // Post("Test.Setup"); AddMethod(obj.bang); AddMethod(obj.MyFloat); AddMethod(obj.symbol); AddMethod(obj.list); AddMethod(0,"set",obj.set); AddMethod(0,"send",obj.send); AddMethod(0,"trigger",obj.trigger); AddMethod(0,obj.MyObject); AddMethod(0,obj.MyAnything); AddMethod(1,obj.MyFloat1); AddMethod(1,obj.MyAny1); return ClassType.Default; }
static void Main(string[] args) { // initialize an instance with nothing test test1 = new test(); // initialize an instance with an integer test test2 = new test(3); // initialize an instance with a string test test3 = new test("Foo"); // initialize an instance with a string and integer test test4 = new test("Foo", 3); // write out the results Console.WriteLine("Test 1 Result:" + test1.ourMessage); Console.WriteLine("Test 2 Result:" + test2.ourMessage); Console.WriteLine("Test 3 Result:" + test3.ourMessage); Console.WriteLine("Test 4 Result:" + test4.ourMessage); // pause to keep the window open Console.Read(); }
public IEnumerator shoot() { while(Input.GetMouseButton(0)) { audioSource.PlayOneShot(audioClip); Debug.DrawRay(ray.origin, mainCamera.transform.forward * 500); if(Physics.Raycast(ray.origin, mainCamera.transform.forward, out hit)) { Debug.Log(hit.transform.name); if(hit.collider.GetComponent<test>()) { hitObject = hit.collider.GetComponent<test>(); hitObject.Damaged(damage); } } yield return new WaitForSeconds(rateOfFire); } }
public ITest convert(test xmlTest) { var test = testFactory.Create(); test.Name = xmlTest.name; test.Description = xmlTest.description; foreach (var item in xmlTest.Items) { ITask task = null; if (item is question) { task = convert((question) item); } else if (item is exercise) { task = convert((exercise)item); } else { System.Console.WriteLine("unknown task type: " + item.GetType()); } if (task != null) { test.Tasks.Add(task); task.Description = task.Description.Replace(VolumeProvider.PATH_PLACEHOLDER, volumeProvider.GetPath()); } } return test; }
public void Start() { GameObject TESTER = GameObject.FindGameObjectWithTag ("GameController"); Test = TESTER.GetComponent<test>(); p = FindObjectsOfType<PathDefinition> (); for (int i = 0; i < p.Length; i++) { if (i == 0) P1 = p [i]; else if (i == 1) P2 = p [i]; else if (i == 2) P3 = p [i]; } if (Test.randomSpawn == 1 ) Path = P2; else if (Test.randomSpawn == 2 ) Path = P1; else if( Test.randomSpawn == 3) Path = P3; //Path = FindObjectOfType<PathDefinition> (); if (Path == null) { Debug.LogError("Path cannot be null", gameObject); return; } _currentPoint = Path.GetPathsEnumerator (); _currentPoint.MoveNext (); if (_currentPoint.Current == null) return; //transform.position = _currentPoint.Current.position; }
//static Dictionary<string, int> skillOrder = new Dictionary<string, int>() { { } }; static test skrivanek_Demo(bool isSkrivanek, CourseIds lang, bool isCompl, string id, string title) { var skills = test_Demo_map(isSkrivanek).Element(lang.ToString()).Element(id).Element(isCompl.ToString()); test res = new test { isDemoTest = true, title = title, Items = skills.Elements().Select(skill => new taskTestSkill { type = runtimeType.taskTestSkill | runtimeType.noDict | runtimeType.mod | runtimeType.dynamicModuleData, title = skill.Name.LocalName, skill = skill.Name.LocalName, minutes = 5, //Items = skill.Elements().Select(grp => new ptr(true, (isSkrivanek ? "/skrivanek" : "/lm") + string.Format("/demo/{0}/{1}/{2}/ex", lang, skill.Name.LocalName, grp.Name.LocalName)) { takeChilds = childMode.selfChild }).ToArray(), Items = skill.Elements().Select(grp => new ptr(true, string.Format("/skrivanek/demo/{0}/{1}/{2}/ex", lang, skill.Name.LocalName, grp.Name.LocalName)) { takeChilds = childMode.selfChild }).ToArray(), }).ToArray() }; return res; }
public IHttpActionResult PostTestNull(test value) { object data = null; return(Ok(data)); }
public void create(test t) { t.length = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(uint))); }
public void assertNotSame() { test ham = new test(); Assert.AreNotSame(null, ham.isNull(1)); }
public void assertTrue() { test ham = new test(); Assert.IsTrue(true, ham.isNull(0)); }
private List<CodeMemberMethod> CreateWebDriverTestMethods(List<CodeMemberMethod> testMethods, TestClassGenerationContext generationContext, test.Selenium.DriverConfiguration.ConfigurationSectionHandler webDriverConfig) { List<CodeMemberMethod> webDriverTestMethods = new List<CodeMemberMethod>(); var activeDrivers = webDriverConfig.RemoteDrivers.GetActiveDrivers(); foreach (CodeMemberMethod testMethod in testMethods) { foreach (var remoteDriver in activeDrivers) { var browserTagsList = GetBrowserTagsList(remoteDriver); var scenarioTags = GetScenarioTags(testMethod.Statements); // If there are any Not<tag> tags, add the driver's key to a list of keys to ignore var tagsStartingWithNot = scenarioTags.FindAll(item => item.StartsWith("Not")); // We need to ensure that these actually correspond to driver tags. If it doesn't, then discard it. var startingWithNotTagsToDiscard = new List<string>(); tagsStartingWithNot.ForEach(item => { bool tagExistsInSomeDriver = false; var browserTagToIgnore = item.Substring("Not".Length, item.Length - "Not".Length); foreach (var driver in activeDrivers) { if (browserTagsList.Contains(browserTagToIgnore)) { tagExistsInSomeDriver = true; } } if (!tagExistsInSomeDriver) { startingWithNotTagsToDiscard.Add(item); } }); tagsStartingWithNot.RemoveAll(item => startingWithNotTagsToDiscard.Contains(item)); var keysToIgnore = new List<string>(); tagsStartingWithNot.ForEach(item => { var browserTagToIgnore = item.Substring("Not".Length, item.Length - "Not".Length); // Find any browsers that have this tag foreach (var driver in activeDrivers) { if (browserTagsList.Contains(browserTagToIgnore)) { keysToIgnore.Add(driver.Key); } } }); var tagsStartingWithOnly = scenarioTags.FindAll(item => item.StartsWith("Only")); // We need to ensure that these actually correspond to driver tags. If it doesn't, then discard it. var startingWithOnlyTagsToDiscard = new List<string>(); tagsStartingWithOnly.ForEach(item => { bool tagExistsInSomeDriver = false; var onlyBrowserTag = item.Substring("Only".Length, item.Length - "Only".Length); foreach (var driver in activeDrivers) { if (GetBrowserTagsList(driver).Contains(onlyBrowserTag)) { tagExistsInSomeDriver = true; } } if (!tagExistsInSomeDriver) { startingWithOnlyTagsToDiscard.Add(item); } }); tagsStartingWithOnly.RemoveAll(item => startingWithOnlyTagsToDiscard.Contains(item)); // If there is an Only<tag> tag, add all other driver keys to the ignore list if (tagsStartingWithOnly.Count > 0) { var lastStartingWithOnlyTag = tagsStartingWithOnly[tagsStartingWithOnly.Count - 1]; var onlyBrowserTag = lastStartingWithOnlyTag.Substring("Only".Length, lastStartingWithOnlyTag.Length - "Only".Length); foreach (var driver in activeDrivers) { if (!GetBrowserTagsList(driver).Contains(onlyBrowserTag)) { keysToIgnore.Add(driver.Key); } } } if (keysToIgnore.Contains(remoteDriver.Key)) { continue; } // Duplicate the test method verbatim, alter its method name and add a property so it's unique to this remoteDriver CodeMemberMethod clonedTestMethod = testMethod.Clone(); string testMethodSuffix = "_With_" + remoteDriver.Key; if (remoteDriver.TestMethodSuffix != String.Empty) { testMethodSuffix = remoteDriver.TestMethodSuffix; } clonedTestMethod.Name = clonedTestMethod.Name + testMethodSuffix; CodeDomHelper.AddAttribute(clonedTestMethod, PROPERTY_ATTR, "WebDriver", remoteDriver.Key); // We need to set up the scenario first, so we insert our Given directly after it. int insertIndex = GetScenarioSetupStatementIndex(clonedTestMethod.Statements) + 1; clonedTestMethod.Statements.Insert(insertIndex, new CodeSnippetStatement(String.Format(GivenIAmUsingTheBrowser, remoteDriver.Key))); webDriverTestMethods.Add(clonedTestMethod); } } return webDriverTestMethods; }
public void assertFalse() { test ham = new test(); Assert.False(false, ham.isEven(1)); }
public void TestMethod1() { IEnumerable <int> coll = new int[0]; IEnumerable coll2 = coll; var blah = new test <IEnumerable <int> >(); }
public static void Main() { test MyBug = new test(); Console.WriteLine(MyBug.mytest()); }
public test() { //using bar //without this, IFoo myFoo = new test(); int val = myFoo.FooProp.BarProp; //<-- **BarProp is not inaccessable here** }
public void GetFormFieldList(string itemSKU) { string modulePath = this.AppRelativeTemplateSourceDirectory; string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName; string aspxRootPath = ResolveUrl("~/"); hst = AppLocalized.getLocale(modulePath); string pageExtension = SageFrameSettingKeys.PageExtension; List <test> arrList = new List <test>(); int attributeSetId = 0; int index = 0; List <AttributeFormInfo> frmItemFieldList = AspxItemMgntController.GetItemFormAttributesByItemSKUOnly(itemSKU, aspxCommonObj); StringBuilder dynHtml = new StringBuilder(); foreach (AttributeFormInfo item in frmItemFieldList) { bool isGroupExist = false; dynHtml = new StringBuilder(); if (index == 0) { attributeSetId = (int)item.AttributeSetID; itemTypeId = (int)item.ItemTypeID; } index++; test t = new test(); t.key = (int)item.GroupID; t.value = item.GroupName; t.html = ""; foreach (test tt in arrList) { if (tt.key == item.GroupID) { isGroupExist = true; break; } } if (!isGroupExist) { if ((item.ItemTypeID == 2 || item.ItemTypeID == 3) && item.GroupID == 11) { } else { arrList.Add(t); } } StringBuilder tr = new StringBuilder(); if ((item.ItemTypeID == 2 || item.ItemTypeID == 3) && item.AttributeID == 32 && item.AttributeID == 33 && item.AttributeID == 34) { } else { tr.Append("<tr><td class=\"cssClassTableLeftCol\"><label class=\"cssClassLabel\">" + item.AttributeName + ": </label></td>"); tr.Append("<td><div id=\"" + item.AttributeID + "_" + item.InputTypeID + "_" + item.ValidationTypeID + "_" + item.IsRequired + "_" + item.GroupID + "_" + item.IsIncludeInPriceRule + "_" + item.IsIncludeInPromotions + "_" + item.DisplayOrder + "\" name=\"" + item.AttributeID + "_" + item.InputTypeID + "_" + item.ValidationTypeID + "_" + item.IsRequired + "_" + item.GroupID + "_" + item.IsIncludeInPriceRule + "_" + item.IsIncludeInPromotions + "_" + item.DisplayOrder + "\" title=\"" + item.ToolTip + "\">"); tr.Append("</div></td>"); tr.Append("</tr>"); } foreach (test ttt in arrList) { if (ttt.key == item.GroupID) { ttt.html += tr; } } StringBuilder itemTabs = new StringBuilder(); dynHtml.Append("<div id=\"dynItemDetailsForm\" class=\"sfFormwrapper\" style=\"display:none\">"); dynHtml.Append("<div class=\"cssClassTabPanelTable\">"); dynHtml.Append( "<div id=\"ItemDetails_TabContainer\" class=\"responsive-tabs\">"); for (var i = 0; i < arrList.Count; i++) { itemTabs.Append("<h2><span>" + arrList[i].value + "</span></a></h2>"); itemTabs.Append("<div id=\"ItemTab-" + arrList[i].key + "\"><div><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" + arrList[i].html + "</table></div></div>"); } itemTabs.Append("<h2><span>" + getLocale("Tags") + "</span></h2>"); StringBuilder itemTagsBody = new StringBuilder(); itemTagsBody.Append("<div class=\"cssClassPopularItemTags\"><h2>" + getLocale("Popular Tags:") + "</h2><div id=\"divItemTags\" class=\"cssClassPopular-Itemstags\"></div>"); if (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer") { itemTagsBody.Append("<h2>" + getLocale("My Tags:") + "</h2><div id=\"divMyTags\" class=\"cssClassMyTags\"></div>"); itemTagsBody.Append("<table id=\"AddTagTable\"><tr><td>"); itemTagsBody.Append("<input type=\"text\" class=\"classTag\" maxlength=\"20\"/>"); itemTagsBody.Append("<button class=\"cssClassDecrease\" type=\"button\"><span>-</span></button>"); itemTagsBody.Append("<button class=\"cssClassIncrease\" type=\"button\"><span>+</span></button>"); itemTagsBody.Append("</td></tr></table>"); itemTagsBody.Append( "<div class=\"sfButtonwrapper\"><button type=\"button\" id=\"btnTagSubmit\"><span>" + getLocale("+ Tag") + "</span></button></div>"); } else { SageFrameConfig sfConfig = new SageFrameConfig(); itemTagsBody.Append("<a href=\"" + aspxRedirectPath + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + pageExtension + "?ReturnUrl=" + aspxRedirectPath + "item/" + itemSKU + pageExtension + "\" class=\"cssClassLogIn\"><span>" + getLocale("Sign in to enter tags") + "</span></a>"); } itemTagsBody.Append("</div>"); itemTabs.Append( "<div id=\"ItemTab-Tags\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>" + itemTagsBody + "</td></tr></table></div>"); itemTabs.Append("<h2><span>" + getLocale("Ratings & Reviews") + " </span></h2>"); itemTabs.Append( "<div id=\"ItemTab-Reviews\"><table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\" id=\"tblRatingPerUser\"><tr><td></td></tr></table>"); itemTabs.Append ("<div class=\"cssClassPageNumber\" id=\"divSearchPageNumber\"><div class=\"cssClassPageNumberMidBg\">"); itemTabs.Append("<div id=\"Pagination\"></div><div class=\"cssClassViewPerPage\">" + getLocale("View Per Page:") + "<select id=\"ddlPageSize\" class=\"sfListmenu\">"); itemTabs.Append( "<option value=\"5\">5</option><option value=\"10\">10</option><option value=\"15\">15</option><option value=\"20\">20</option><option value=\"25\">25</option><option value=\"40\">40</option></select></div>"); itemTabs.Append("</div></div></div>"); itemTabs.Append("<h2 style=\"display:none\"><span>" + getLocale("Videos") + " </span></h2>"); itemTabs.Append("<div><div id=\"ItemVideos\" style=\"display:none\"></div></div>"); dynHtml.Append(itemTabs); dynHtml.Append("</div></div></div>"); } if (itemSKU.Length > 0) { string script = BindDataInTab(itemSKU, attributeSetId, itemTypeId); string tagBind = ""; tagBind = GetItemTags(itemSKU); dynHtml.Append(script); dynHtml.Append(tagBind); ltrItemDetailsForm.Text = dynHtml.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { lblType.Text = "<a href=\"Default.aspx\">123</a>"; SerializeOverride(); string xmlstr = xmlSer(); main mm = xmlDSer(xmlstr) as main; List <test> list = new List <test>() { new test() { name = "abc", age = "123" }, new test() { name = "aaa", age = "444" } }; string s2 = "中国人"; main m1 = new main(); m1.m = list; test t = new test() { name = "abc", age = "123" }; XmlSerializer xml = new XmlSerializer(typeof(main)); MemoryStream ms = new MemoryStream(); string ss = ""; XmlTextWriter writer = new XmlTextWriter(ms, Encoding.UTF8); xml.Serialize(writer, m1); ms.Position = 0; using (StreamReader reader = new StreamReader(ms, Encoding.UTF8)) { ss = reader.ReadToEnd(); } writer.Close(); byte[] b = new byte[Encoding.UTF8.GetBytes(s2).Length]; byte[] b2 = new byte[Encoding.UTF8.GetBytes(s2).Length]; Encoding.UTF8.GetBytes(s2, 1, 1, b, 0);; Encoding.UTF8.GetBytes(s2, 0, s2.Length, b2, 0); MemoryStream ms2 = new MemoryStream(Encoding.UTF8.GetBytes(ss)); using (StreamReader sr = new StreamReader(ms2, Encoding.UTF8)) { main m2 = (main)xml.Deserialize(sr); } // string ss = Encoding.UTF8.GetString(ms.ToArray()); //IFormatter formatter = new BinaryFormatter(); //test t = new test() { name = "abc", age = "123" }; DataTable result = new DataTable(); PropertyInfo[] propertys = t.GetType().GetProperties(); foreach (PropertyInfo pi in propertys) { result.Columns.Add(pi.Name, pi.PropertyType); } for (int i = 0; i < list.Count; i++) { ArrayList tempList = new ArrayList(); foreach (PropertyInfo pi in propertys) { object obj = pi.GetValue(list[i], null); tempList.Add(obj); } object[] array = tempList.ToArray(); result.Rows.Add(array); } string s = ""; }
public test2(test t, test1 t1) { }
public HomeController(Imodule_mainServices module_mainServicesServices, Imodule_homechildrenServices module_homechildrenServices, test _Mytest) { _module_mainServicesServices = module_mainServicesServices; _module_homechildrenServices = module_homechildrenServices; Mytest = _Mytest; }
public void TestCountReturnsCorrectValuesForMultipleAnyParameterMethod() { var mock = new Mirror<ITest>(); var test = new test(); mock.It.DoStuff(null, "a"); mock.It.DoStuff(null, "a"); mock.It.DoStuff(null, "b"); mock.It.DoStuff(new test(), "c"); mock.It.DoStuff(test, "c"); mock.It.DoStuff(test, "a"); Assert.AreEqual(6, mock.Count(s => s.DoStuff(Any<test>.Value, Any<string>.Value))); Assert.AreEqual(3, mock.Count(s => s.DoStuff(null, Any<string>.Value))); Assert.AreEqual(2, mock.Count(s => s.DoStuff(Any<test>.Value, "c"))); Assert.AreEqual(2, mock.Count(s => s.DoStuff(test, Any<string>.Value))); }
public void Test4(test e) { }
if (is_prime(test)) {
public static void Main() { test t = new test(); Emit(t.x[1]); }
public void FixSiteEdges(ref VoronoiDiagram diag, int site) { if (diag == null) { return; } List <test> poly = new List <test>(); int firstEdge, lastEdge; Vector2 polyCenter = Vector2.zero; if (site == diag.Sites.Count - 1) { firstEdge = diag.FirstEdgeBySite[site]; lastEdge = diag.Edges.Count - 1; } else { firstEdge = diag.FirstEdgeBySite[site]; lastEdge = diag.FirstEdgeBySite[site + 1] - 1; } for (int i = firstEdge; i < lastEdge; i++) { test _test = new test(); _test.index = diag.Edges[i].Vert0; _test.diag = diag; poly.Add(_test); polyCenter += diag.Vertices[poly[poly.Count - 1].index]; } polyCenter /= poly.Count; //VALIDATE for (int i = 0; i < poly.Count; i++) { for (int j = 0; j < poly.Count; j++) { if (poly[i].index == poly[j].index) { Debug.LogError("THEY MATCH THIS IS BAD"); } } } //List<Vector2> polyList = new List<Vector2>(); //foreach (test t in poly) //{ // polyList.Add(new Vector2(diag.Vertices[t.index].x, diag.Vertices[t.index].y)); //} //CityTest.LineRenderPoly(polyList); poly.Sort((a, b) => { double a2 = ((Mathf.Rad2Deg * (Mathf.Atan2(a.diag.Vertices[a.index].x - polyCenter.x, a.diag.Vertices[a.index].y - polyCenter.y)) + 360.0f) % 360.0f); double a1 = ((Mathf.Rad2Deg * (Math.Atan2(a.diag.Vertices[b.index].x - polyCenter.x, a.diag.Vertices[b.index].y - polyCenter.y)) + 360.0f) % 360.0f); return((int)(a1 - a2)); } //((Mathf.Rad2Deg * (Mathf.Atan2(a.diag.Vertices[a.index].x - polyCenter.x, a.diag.Vertices[a.index].y - polyCenter.y)) + 360) % 360).CompareTo((Mathf.Rad2Deg * (Math.Atan2(a.diag.Vertices[b.index].x - polyCenter.x, a.diag.Vertices[b.index].y - polyCenter.y)) + 360) % 360) ); //polyList.Clear(); //foreach (test t in poly) //{ // polyList.Add(new Vector2(diag.Vertices[t.index].x, diag.Vertices[t.index].y)); //} //CityTest.LineRenderPoly(polyList); for (int i = 0; i < poly.Count; i++) { int nextIndex = poly[0].index; if (nextIndex + 1 < poly.Count) { nextIndex = poly[i + 1].index; } diag.Edges[firstEdge + i] = new VoronoiDiagram.Edge(diag.Edges[i].Type, diag.Edges[i].Site, poly[i].index, nextIndex, diag.Vertices[nextIndex] - diag.Vertices[poly[i].index]); } //List<Vector2> poly222 = new List<Vector2>(); // //for (int ei = firstEdge; ei <= lastEdge; ei++) //{ // poly222.Add(diag.Vertices[diag.Edges[ei].Vert0]); //} // //CityTest.LineRenderPoly(poly222); }
private static void Test(ref test objtest) { objtest.Name = "chetan"; objtest = null; }
public void assertNotNull() { test ham = new test(); Assert.NotNull(false, ham.isNull(1)); }
public test GetTestById(int id) { test testObj = db.test.FirstOrDefault(t => t.id == id); return(testObj); }
public void assertNull() { test ham = new test(); Assert.Null(null, ham.isNull(0)); }
double runTest(test t) { return measureWorkUnitsPerSecond(t.Threads, t.DurationMS, t.Work, t.Name) / t.Devider; }
public EditModel(test context) { _context = context; }
static void Main(string[] args) { Program p = new Program(); // this is the delegate instantiation //Name.CompareFirstNames saticka funkcija //pokazuvac kon funkcija = delegate Comparer cmp = new Comparer(Name.CompareFirstNames); Console.WriteLine("==========Before sort==========="); p.PrintNames(); p.Sort(cmp); Console.WriteLine("==========After sort==========="); p.PrintNames(); Console.WriteLine("==========My delegate tesst==========="); //pointer declaration test t1 = new test(Name.PrintTest); //pointer call t1(); EventDemo eventd = new EventDemo(); //Application.EnableVisualStyles(); // Application.Run(new EventDemo()); Console.ReadKey(); }
public void TestMethod1() { test TestClass = new test(); Assert.AreEqual(TestClass.addCount(), 1); }
private static List<string> GetBrowserTagsList(test.Selenium.DriverConfiguration.RemoteWebDriverConfigElement driverConfigElement) { List<string> browserTagsList = new List<string>(); if (driverConfigElement.BrowserTags != null) { string[] browserTags = driverConfigElement.BrowserTags.Split(); browserTagsList = browserTags.ToList<string>(); } return browserTagsList; }
public void show(test test) { test.show(); }
static void Main(string[] args) { //声明变量,初始化变化,输出变量信息。 var bob = new Person(); bob.Name = "Bob smith"; bob.DateOfBirth = new DateTime(1965, 12, 22); WriteLine(format: "{0} was born on {1: dddd, d MMMM yyyy}", arg0: bob.Name, arg1: bob.DateOfBirth); //新增bob变量的FavoriteAncientWonder的值。 bob.Children.Add(new Person { Name = "Alfred" }); bob.Children.Add(new Person { Name = "Zoe" }); WriteLine($"{bob.Name} has {bob.Children.Count} children:"); foreach (Person p1 in bob.Children) { WriteLine($"{p1.Name}"); } // for (int child = 0; child < bob.Children.Count; child++) // { // WriteLine($" {bob.Children[child].Name}") ; // } //bob.FavoriteAncientWonder = WondersOfTheAncientWorld.StatueOfZeusAtOlympia; bob.BucketList = WondersOfTheAncientWorld.HangingGardensOfBabylon | WondersOfTheAncientWorld.MausoleumAtHalicarnassus; WriteLine($"{bob. Name}' s bucket list is {bob. BucketList}"); //输出 WriteLine(format: "{0}'s FavoriteAncientWonder is {1},It's integer is {2}.", arg0: bob.Name, arg1: bob.FavoriteAncientWonder, arg2: (int)WondersOfTheAncientWorld.StatueOfZeusAtOlympia); //新增alice变量 var alice = new Person() { Name = "Alice Jones", DateOfBirth = new DateTime(1984, 7, 3) }; WriteLine(format: "{0} was born on {1:dd MMM yy}", arg0: alice.Name, arg1: alice.DateOfBirth); BankAccount.InterestRate = 0.012M; var jonesAccount = new BankAccount(); jonesAccount.AccountName = "Mrs jones"; jonesAccount.Balance = 2400M; WriteLine(format: "{0} earned {1:C} interest rate.", arg0: jonesAccount.AccountName, arg1: jonesAccount.Balance * BankAccount.InterestRate); var gerrierAccount = new BankAccount(); gerrierAccount.AccountName = "Mr gerrier"; gerrierAccount.Balance = 98M; WriteLine(format: "{0} earned {1:C} interest rate.", arg0: gerrierAccount.AccountName, arg1: gerrierAccount.Balance * BankAccount.InterestRate); WriteLine($"{bob.Name} is a {Person.Species}"); WriteLine($"{bob.Name} was born in {bob.HomePlanet}"); var blankPerson = new Person(); WriteLine(format: "{0} of {1} was create at {2:hh:mm:ss} on a {2:dddd}.", arg0: blankPerson.Name, arg1: blankPerson.HomePlanet, arg2: blankPerson.Instantiated); var gunny = new Person("gunny", "Mars"); WriteLine(format: "{0} of {1} was create at {2:hh:mm:ss} on a {2:dddd}.", arg0: gunny.Name, arg1: gunny.HomePlanet, arg2: gunny.Instantiated); bob.WriteToConsole(); WriteLine(bob.GetOrigin()); (string Name, int Number)fruit = bob.GetFruit(); (string Name, int Number) = bob.GetFruit(); WriteLine($"There are {fruit.Number} {fruit.Name}."); WriteLine($"Deconstructed: {Name},{Number}"); var thing1 = ("Neville", 4); WriteLine($"{thing1.Item1} has {thing1.Item2} children. "); var thing2 = (bob.Name, bob.Children.Count); WriteLine($"{thing2.Name} has {thing2.Count} children. "); WriteLine(bob.SayHello()); WriteLine(bob.SayHello("Emily")); WriteLine(bob.OptionalParameters()); WriteLine(bob.OptionalParameters("jump", 98.5)); WriteLine(bob.OptionalParameters(number: 52.9, command: "Hide!")); WriteLine(bob.OptionalParameters("Poke!", active: true)); int a = 10, b = 20, c = 30; WriteLine("a = {0},b = {1},c = {2},", a, b, c); bob.PassingParameters(a, ref b, out c); WriteLine("a = {0},b = {1},c = {2},", a, b, c); int d = 10, e = 20; WriteLine($"Before: d = {d}, e = {e}, f doesn' t exist yet! "); // simplified C# 7. 0 syntax for the out parameter bob.PassingParameters(d, ref e, out int f); WriteLine($"After: d = {d}, e = {e}, f = {f}"); var sam = new Person { Name = "Sam", DateOfBirth = new DateTime(1972, 1, 27) }; WriteLine(sam.Origin); WriteLine(sam.Greeting); WriteLine(sam.Age); sam.FavoriteIceCream = "Chocolate Fudge"; WriteLine($"Sam's favorite ice-cream flavor is {sam.FavoriteIceCream}. "); sam.FavoritePrimaryColor = "red"; WriteLine($"Sam' s favorite primary color is {sam.FavoritePrimaryColor}. "); test t1 = new test(); t1.setProperty("test"); WriteLine(t1.getTest()); //Indexers sam.Children.Add(new Person { Name = "Charlie" }); sam.Children.Add(new Person { Name = "Ella" }); WriteLine($"Sam' s first child is {sam.Children[0] . Name}"); WriteLine($"Sam' s second child is {sam.Children[1] . Name}"); WriteLine($"Sam' s first child is {sam[0].Name}"); WriteLine($"Sam' s second child is {sam[1].Name}"); }
public void bug_0_int_was_treated_as_serializable() { var test = new test(); var item = new SerializableItem(test.GetType().GetField("intf"), test); Assert.False(item.IsSerializable); }
public Task <string> DecryptString([FromBody] test str) { return(Task.FromResult(CryptographicService.DecryptString(str.Str))); }
static void DoCall (test t) { }
await SynchronizationContextHelper.RunTestAsync(test, TestTimeout);
public static void Main() { Console.WriteLine(i); test t = new test(); t.showReadOnly(); }
public void assertEqual() { test ham = new test(); Assert.AreEqual(10, ham.add(9, 1)); }
public LevelLeaderboard getLeaderboard(string id, Transform parent) { LevelLeaderboard leaderboard = null; if (isCurrentLeaderboard(id)) { return(currentLeaderboard); } else if (currentLeaderboard != null) { currentLeaderboard.showSlots(false); } leaderboard = existLeaderboard(id); if (leaderboard != null) { currentLeaderboard = leaderboard; return(leaderboard); } if (leaderboards.Count == maxLeaderbords) { print("todelete"); disposeLedearboard(leaderboards [maxLeaderbords - 1]); } GameObject go = new GameObject(id); leaderboard = go.AddComponent <LevelLeaderboard> (); go.transform.SetParent(this.transform); leaderboard.id = id; leaderboard.slot = slot; leaderboard.parent = parent; test[] test = null; if (!KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn) { test = new test[Random.Range(3, 6)]; } if (test != null) { for (int i = 0; i < test.Length; i++) { test [i] = new test(); test [i].idFacebook = Random.Range(0, 100).ToString(); test [i].score = Random.Range(100, 20000); test [i].rank = i + 1; } for (int i = 0; i < test.Length; i++) { Sprite sprite = facebook.getSpritePictureById(test [i].idFacebook); string name = facebook.getFriendNameById(test [i].idFacebook); int score = test[i].score; int rank = test[i].rank; if (sprite == null) { sprite = dummyIconImages [Random.Range(0, dummyIconImages.Length)]; } leaderboard.setSlotInfo(sprite, name, score, rank); } } leaderboards.Insert(0, leaderboard); currentLeaderboard = leaderboard; return(leaderboard); }
public test2(test1 t1, test t) { }
public static void Main() { test MyBug = new test(); Console.WriteLine (MyBug.mytest()); }
// Start is called before the first frame update void Start() { time = 0; instance = this; }
static void Main(string[] args) { // methode der kleinsten quadrate // http://www.abi-mathe.de/buch/matrizen/methode-der-kleinsten-quadrate/ var xyPoints = new double[, ] { {0, 2}, {1, 1}, {2, 0}, {3, -1}, {4, 1} }; // 3 entspricht a0,a1, a2 var A = new double[xyPoints.GetLength(0),3]; var b = new double[xyPoints.GetLength(0)]; // initialize (notwendig??s) int hhh = 0; for (int row = 0; row < A.GetLength(0); row++) { for (int column = 0; column < A.GetLength(1); column++) { A[row,column] = hhh; hhh++; } } // add values // f(x)=a0 + a1⋅x + a2⋅x2 for (int row = 0; row < A.GetLength(0); row++) // is 5 row = count of xy points { var xPoint = xyPoints[row,0]; // 0 is X-Value var yPoint = xyPoints[row,1]; // 1 is Y Value // add yPoint to result matrix b[row] = yPoint; for (int column = 0; column < A.GetLength(1); column++) // is 3 { // fill A Matrix var aFactor = Math.Pow(xPoint, column); // 0 is x-value A[row,column] = aFactor; Console.Write(A[row, column] + " "); // fill b Matrix } Console.WriteLine(Environment.NewLine); } Console.WriteLine("b-Matrix: "); foreach (var uu in b) { Console.Write(uu + " "); } // create matriv with math.net Matrix<double> AMatrix = DenseMatrix.OfArray(A); Matrix<double> bMatrix = new DenseMatrix(xyPoints.GetLength(0), 1,b); Matrix<double> AMatrixTranspose = AMatrix.Transpose(); // Um diese Gleichung zu lösen werden nun AT⋅A und AT⋅b berechnet: var ATxA = AMatrixTranspose * AMatrix; var ATxB = AMatrixTranspose * bMatrix; var result= ATxA.Solve(ATxB); Console.WriteLine(Environment.NewLine); var resultArray = result.ToArray(); foreach (var factor in resultArray) { Console.WriteLine("ax: " + factor); } //results from homepage Console.WriteLine("a0: " + (79.0/35)); Console.WriteLine("a1: " +-(74.0/35)); Console.WriteLine("a2: " + 3.0/7); Console.WriteLine(A); Console.ReadKey(); #if false ScriptEngine engine = Python.CreateEngine(); Console.WriteLine(engine.GetHashCode()); ScriptScope scope =engine.CreateScope(); scope.SetVariable("foo", 4); ScriptEngine engine2 = Python.CreateEngine(); Console.WriteLine(engine2.GetHashCode()); ScriptScope scope2 = engine2.CreateScope(); scope2.SetVariable("foo", 2); // execute the script //engine.ExecuteFile(@"C:\path\to\script.py"); var path = @"C:\Users\Marcus\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\hello.py"; var path2 = @"C:\Users\Marcus\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\hello.py"; var one =new test(); var two = new test(); Parallel.Invoke( () => { one.test1(); }, () => { two.test1(); ; } ); // execute and store variables in scope // variables and functions defined in the scrip are added to the scope //scope.SomeFunction(); //Console.WriteLine("Hallo"); //var xxx = new ContainerBuilder(); //xxx.RegisterType<test>(); //IContainer con=xxx.Build(); //using (var ooo = con.BeginLifetimeScope()) //{ // var www=ooo.Resolve<test>(); //} //for(int i = 0; i < 10; i++) //{ // var ccc=new SignalRTargetHub(); // ccc.Hello(); //} //var scope=con.BeginLifetimeScope(); //scope.Resolve<test>(); //scope.Dispose(); //Console.ReadKey(); #endif }
/// <summary> /// 招标公告的查询 /// </summary> /// <returns></returns> private static IList<IDictionary> QueryBidAnounce() { test c=new test(); List<ContentPage> m = new List<ContentPage>(); m.Add(c.GetFirstl()); //设置首页查招标公告的查询参数 Hashtable htparm = new Hashtable(); htparm["level"] = "省级"; htparm["start"] = 1; //记录开始数 htparm["end"] = 10; //记录结束数 //如果不想对每一个查询结果都定义一个类,可以在ibatis map的文件中直接设置 // resultClass="map" ,则查询结果返回的类型是 IList<IDictionary> IList<IDictionary> bidAnounceList = CMSMapper.Get().QueryForList<IDictionary>("ContentPage.QueryBidAnounce", htparm); return bidAnounceList; }
public IEnumerable <question> GetQuestionsBySubcategory(int subcategoryId) { test test = context.tests.First(x => x.subcategoryID == subcategoryId); return(context.questions.Where(x => x.testid == test.testID).ToList()); }