public void TestTest() { Class1 target = new Class1(); string value = null; int actual; try { actual = target.Test(value); } catch (ArgumentNullException) { // continue } value = string.Empty; int expected = 0; actual = target.Test(value); Assert.AreEqual(expected, actual); value = "test"; expected = 4; actual = target.Test(value); Assert.AreEqual(expected, actual); }
private void Form1_Shown(object sender, EventArgs e) { Class1 qwe = new Class1(); Text = qwe.i.ToString(); pictureBox1.Image = qwe.getImage(); }
public void TestConvert6() { string a = "(fgdgd){}"; var clase = new Class1(); bool resultado = clase.validar(a); Assert.IsTrue(resultado); }
/// <summary> /// Ako je po defaultu odabran engleski jezik, tada se izvršava sljedeći konstruktor. /// </summary> public frmStart() { ClassLibrary1.Class1 words = new ClassLibrary1.Class1(); randomWords = words.GetWordList(); InitializeComponent(); }
public void Main(string[] args) { var c = new Class1(); c.DoIt(); var t = Type.GetType("ClassLibrary1.Class1"); if (t != null) { Console.WriteLine(t.Name); } var library = libraryManager.GetLibrary("ClassLibrary1"); var a = Assembly.Load(library.Assemblies.First()); t = a.GetType("Class1"); if (t != null) { Console.WriteLine(t.Name); } t = a.GetType("ClassLibrary1.Class1"); if (t != null) { Console.WriteLine(t.Name); } t = a.GetTypes().First(); Console.WriteLine(t.Name); }
public void TestConvert5() { string a = "CM"; var clase = new Class1(); int resultado = clase.convertir(a); Assert.IsTrue(resultado.Equals(900)); }
static void Main(string[] args) { Class1 cs = new Class1(); //string temp = cs.tagstext(); //Console.WriteLine( temp); Console.ReadLine(); }
static void Main(string[] args) { Console.Write("main clas"); Class1 ob=new Class1(); ob.write2(); Console.Read(); }
public void Function1_should_return_1() { // Arrange var sut = new Class1(); // Act var result = sut.Function1(); // Assert Assert.AreEqual(1, result); }
private static void Main(string[] args) { Student student = new Student(); student.name = "口"; student.phone = "123"; Class1 class001 = new Class1(); class001.id = "23232"; }
static void Main(string[] args) { Console.WriteLine("PlayWithJsonImage"); string imagePath = ConfigurationManager.AppSettings["ImageFilePath"]; var class1 = new ClassLibrary1.Class1(imagePath); var json = class1.JsonObject; Console.ReadKey(); }
public static void Main() { ClassLibrary1.Class1 test1 = new ClassLibrary1.Class1(); string lignes = test1.GetApi("http://data.metromobilite.fr/api/linesNear/json?x=5.727770&y=45.185540&dist=600&details=true"); ClassLibrary1.Class1 test2 = new ClassLibrary1.Class1(); string details = test2.GetApi("https://data.metromobilite.fr/api/routers/default/index/routes"); // Display the content. List <Ligne> Lignes = JsonConvert.DeserializeObject <List <Ligne> >(lignes); Dictionary <string, List <string> > detail = new Dictionary <string, List <string> >(); List <DetailObject> Details = JsonConvert.DeserializeObject <List <DetailObject> >(details); foreach (Ligne Ligne in Lignes) { if (!detail.ContainsKey(Ligne.name)) { detail.Add(Ligne.name, Ligne.lines); } //afficher les arrêts sans le dictionnaire// //Console.WriteLine("Arrêt1 :" + Ligne.name); ///afficher les lignes de transport sans le dictionnaire/// // Console.WriteLine("Lignes :"); foreach (string line in Ligne.lines) { if (!detail[Ligne.name].Contains(line)) { detail[Ligne.name].Add(line); } //ligne de transport //Console.WriteLine(line); } detail[Ligne.name] = detail[Ligne.name].Distinct().ToList(); } foreach (KeyValuePair <string, List <string> > kvp in detail) { Console.WriteLine("arrêt:" + kvp.Key); foreach (string ligne in kvp.Value) { foreach (DetailObject Detail in Details) { if (Detail.id.Contains(ligne)) { Console.WriteLine("lignes:" + ligne); Console.WriteLine(Detail.longName); Console.WriteLine(Detail.mode); Console.WriteLine(Detail.type); } } } } }
public void Class1_Initialize() { // Arrange const string expectedValue = Class1.DEFAULT_VALUE; var instance = new Class1(); // Act instance.Initialize(); string actualValue = instance.Property1; // Assert Assert.AreEqual(expectedValue, actualValue); }
static void Main(string[] args) { try { Class1 myClass = new Class1(); Console.WriteLine("Class1: " + myClass.WriteOut1()); MyResidentClassInLib1 myClass2 = new MyResidentClassInLib1(); Console.WriteLine("Class2: " + myClass2.WriteOut2()); } catch (Exception e) { Console.WriteLine("Exception occurred: " + e.ToString()); } }
public void TestOfLibraryProject() { //Arrange //instansierade class1 i libraryprojektet med en sut-variabel (standard variabel, System Under Test) //skickar med två siffror Class1 sut = new Class1(); int i1 = 2; int i2 = 3; //Act sut.add(i1, i2); //Assert Assert.AreEqual(5, sut.result); //Assert.Fail(); }
static void Main(string[] args) { /* Console.WriteLine("Hello World!"); * for (int i=1;i<=100;i++) * { * //check the no divisible by 3 then print Fizz or check the no divisible by 5 then print Buzz * if ((i % 3 ) == 0) * Console.WriteLine("Fizz"); * if ((i % 5) == 0) * Console.WriteLine("Buzz"); * * if ((i % 3 != 0) && (i % 5 != 0)) * Console.WriteLine(i); * * * * } * Console.ReadKey();*/ ClassLibrary1.Class1 c = new ClassLibrary1.Class1(); c.Main(); }
public void Main(string[] args) { Console.WriteLine("Test"); Class1 ourObject = new Class1(); try { ourObject.TestClass(); } catch (Exception e) { if (e.Message != null) { Console.WriteLine(e.Message); Console.ReadLine(); } else { throw; } } }
private void Calculate_Click(object sender, RoutedEventArgs e) { int a, b; float fA, fB; a = int.Parse(textBoxA.Text); b = int.Parse(textBoxB.Text); fA = float.Parse(textBoxfA.Text); fB = float.Parse(textBoxfB.Text); try { ClassLibrary1.Class1 externalDLL = new ClassLibrary1.Class1(); Substract.Sub substractDLL = new Substract.Sub(); textBoxCalc.Text = externalDLL.sum(a, b).ToString(); textBoxCalcSubstract.Text = substractDLL.substract(fA, fB).ToString(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void TestMethod67() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v4 = (System.Int32)(-3); System.Int32 v5 = (System.Int32)(-3); System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-6, v6,"Regression Failure? [9]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)(-3) (System.Int32)(-3) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod66() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v3 = (System.Int32)3; System.Int32 v4 = (System.Int32)0; System.Int32 v5 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v3, (System.Int32)v4) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(3, v5,"Regression Failure? [87]"); System.Int32 v6 = (System.Int32)2; System.Int32 v7 = (System.Int32)0; System.Int32 v8 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v6, (System.Int32)v7) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(2, v8,"Regression Failure? [88]"); System.Int32 v9 = (System.Int32)0; System.Int32 v10 = (System.Int32)(-6); System.Int32 v11 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v9, (System.Int32)v10) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-6, v11,"Regression Failure? [89]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v13 = (System.Int32)(-3); System.Int32 v14 = (System.Int32)3; System.Int32 v15 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v13, (System.Int32)v14) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(0, v15,"Regression Failure? [90]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v17 = (System.Int32)0; System.Int32 v18 = (System.Int32)3; System.Int32 v19 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v17, (System.Int32)v18) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(3, v19,"Regression Failure? [91]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)3 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)2 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)0 (System.Int32)(-6) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)(-3) (System.Int32)3 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)0 (System.Int32)3 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public static void NewMethod(this ClassLibrary1.Class1 ob) //extension method { Console.WriteLine("Hello I am extended method from ClassLibrary1"); }
public void TestMethod20() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)10; System.Int32 v2 = (System.Int32)7; System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(17, v3,"Regression Failure? [237]"); System.Int32 v4 = (System.Int32)13; System.Int32 v5 = (System.Int32)10; System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(23, v6,"Regression Failure? [238]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v8 = (System.Int32)(-10); System.Int32 v9 = (System.Int32)(-3); System.Int32 v10 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v8, (System.Int32)v9) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-13, v10,"Regression Failure? [239]"); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v13 = (System.Int32)24; System.Int32 v14 = (System.Int32)(-1); System.Int32 v15 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v13, (System.Int32)v14) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(23, v15,"Regression Failure? [240]"); ((ClassLibrary1.Class1)v0).cal() ; /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)10 (System.Int32)7 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)13 (System.Int32)10 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)(-10) (System.Int32)(-3) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)24 (System.Int32)(-1) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() */ //END TEST return; }
public void TestMethod18() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)10; System.Int32 v2 = (System.Int32)7; System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(17, v3,"Regression Failure? [197]"); ((ClassLibrary1.Class1)v0).cal() ; /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)10 (System.Int32)7 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() */ //END TEST return; }
public void TestMethod16() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)0; System.Int32 v2 = (System.Int32)7; System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(7, v3,"Regression Failure? [141]"); System.Int32 v4 = (System.Int32)6; System.Int32 v5 = (System.Int32)(-8); System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-2, v6,"Regression Failure? [142]"); System.Int32 v7 = (System.Int32)3; System.Int32 v8 = (System.Int32)45; System.Int32 v9 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v7, (System.Int32)v8) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(48, v9,"Regression Failure? [143]"); ((ClassLibrary1.Class1)v0).cal() ; /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)0 (System.Int32)7 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)6 (System.Int32)(-8) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)3 (System.Int32)45 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() */ //END TEST return; }
public void TestMethod12() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)10; System.Int32 v2 = (System.Int32)7; System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(17, v3,"Regression Failure? [450]"); System.Int32 v4 = (System.Int32)13; System.Int32 v5 = (System.Int32)10; System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(23, v6,"Regression Failure? [451]"); System.Int32 v7 = (System.Int32)23; System.Int32 v8 = (System.Int32)23; System.Int32 v9 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v7, (System.Int32)v8) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(46, v9,"Regression Failure? [452]"); System.Int32 v10 = (System.Int32)(-3); System.Int32 v11 = (System.Int32)10; System.Int32 v12 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v10, (System.Int32)v11) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(7, v12,"Regression Failure? [453]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v14 = (System.Int32)(-10); System.Int32 v15 = (System.Int32)10; System.Int32 v16 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v14, (System.Int32)v15) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(0, v16,"Regression Failure? [454]"); System.Int32 v17 = (System.Int32)149; System.Int32 v18 = (System.Int32)61; System.Int32 v19 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v17, (System.Int32)v18) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(210, v19,"Regression Failure? [455]"); ((ClassLibrary1.Class1)v0).cal() ; /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)10 (System.Int32)7 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)13 (System.Int32)10 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)23 (System.Int32)23 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)(-3) (System.Int32)10 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)(-10) (System.Int32)10 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)149 (System.Int32)61 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() */ //END TEST return; }
private void button6_Click(object sender, EventArgs e) { ClassLibrary1.Class1 j = new ClassLibrary1.Class1(); label3.Text = j.Full_name + "-" + j.Number_of_group + "-" + j.Number_of_lab.ToString() + "-" + j.Number_of_project.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { ClassLibrary1.User user = new ClassLibrary1.User(); ClassLibrary1.Class1 c = new ClassLibrary1.Class1(); user = ClassLibrary1.Class1. }
public void TestMethod7() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)10; System.Int32 v2 = (System.Int32)(-3); System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(7, v3,"Regression Failure? [362]"); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v6 = (System.Int32)0; System.Int32 v7 = (System.Int32)68; System.Int32 v8 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v6, (System.Int32)v7) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(68, v8,"Regression Failure? [363]"); System.Int32 v9 = (System.Int32)0; System.Int32 v10 = (System.Int32)6; System.Int32 v11 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v9, (System.Int32)v10) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(6, v11,"Regression Failure? [364]"); ((ClassLibrary1.Class1)v0).cal() ; /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)10 (System.Int32)(-3) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)0 (System.Int32)68 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)0 (System.Int32)6 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() */ //END TEST return; }
public void TestMethod8() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)10; System.Int32 v2 = (System.Int32)(-3); System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(7, v3,"Regression Failure? [389]"); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v6 = (System.Int32)92; System.Int32 v7 = (System.Int32)48; System.Int32 v8 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v6, (System.Int32)v7) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(140, v8,"Regression Failure? [390]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v10 = (System.Int32)5; System.Int32 v11 = (System.Int32)(-6); System.Int32 v12 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v10, (System.Int32)v11) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-1, v12,"Regression Failure? [391]"); System.Int32 v13 = (System.Int32)23; System.Int32 v14 = (System.Int32)54; System.Int32 v15 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v13, (System.Int32)v14) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(77, v15,"Regression Failure? [392]"); /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)10 (System.Int32)(-3) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)92 (System.Int32)48 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)5 (System.Int32)(-6) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)23 (System.Int32)54 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod41() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v2 = (System.Int32)0; System.Int32 v3 = (System.Int32)(-10); System.Int32 v4 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v2, (System.Int32)v3) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-10, v4,"Regression Failure? [51]"); System.Int32 v5 = (System.Int32)4; System.Int32 v6 = (System.Int32)0; System.Int32 v7 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v5, (System.Int32)v6) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(4, v7,"Regression Failure? [52]"); System.Int32 v8 = (System.Int32)6; System.Int32 v9 = (System.Int32)0; System.Int32 v10 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v8, (System.Int32)v9) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(6, v10,"Regression Failure? [53]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() (System.Int32)0 (System.Int32)(-10) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)4 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)6 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod13() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); /* ClassLibrary1.Class1 constructor Void .ctor() */ //END TEST return; }
public void TestMethod45() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v3 = (System.Int32)10; System.Int32 v4 = (System.Int32)0; System.Int32 v5 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v3, (System.Int32)v4) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(10, v5,"Regression Failure? [58]"); System.Int32 v6 = (System.Int32)(-10); System.Int32 v7 = (System.Int32)0; System.Int32 v8 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v6, (System.Int32)v7) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-10, v8,"Regression Failure? [59]"); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v11 = (System.Int32)4; System.Int32 v12 = (System.Int32)2; System.Int32 v13 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v11, (System.Int32)v12) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(6, v13,"Regression Failure? [60]"); System.Int32 v14 = (System.Int32)6; System.Int32 v15 = (System.Int32)(-10); System.Int32 v16 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v14, (System.Int32)v15) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-4, v16,"Regression Failure? [61]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)10 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)(-10) (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)4 (System.Int32)2 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)6 (System.Int32)(-10) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod17() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v4 = (System.Int32)24; System.Int32 v5 = (System.Int32)2; System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(26, v6,"Regression Failure? [188]"); System.Int32 v7 = (System.Int32)19; System.Int32 v8 = (System.Int32)85; System.Int32 v9 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v7, (System.Int32)v8) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(104, v9,"Regression Failure? [189]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)24 (System.Int32)2 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)19 (System.Int32)85 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod48() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)(-3); System.Int32 v2 = (System.Int32)1; System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-2, v3,"Regression Failure? [64]"); System.Int32 v4 = (System.Int32)(-3); System.Int32 v5 = (System.Int32)(-10); System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-13, v6,"Regression Failure? [65]"); /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)(-3) (System.Int32)1 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)(-3) (System.Int32)(-10) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod19() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v2 = (System.Int32)7; System.Int32 v3 = (System.Int32)17; System.Int32 v4 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v2, (System.Int32)v3) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(24, v4,"Regression Failure? [233]"); System.Int32 v5 = (System.Int32)17; System.Int32 v6 = (System.Int32)0; System.Int32 v7 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v5, (System.Int32)v6) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(17, v7,"Regression Failure? [234]"); System.Int32 v8 = (System.Int32)0; System.Int32 v9 = (System.Int32)(-1); System.Int32 v10 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v8, (System.Int32)v9) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-1, v10,"Regression Failure? [235]"); System.Int32 v11 = (System.Int32)6; System.Int32 v12 = (System.Int32)10; System.Int32 v13 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v11, (System.Int32)v12) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(16, v13,"Regression Failure? [236]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() (System.Int32)7 (System.Int32)17 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)17 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)0 (System.Int32)(-1) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)6 (System.Int32)10 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod1() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); System.Int32 v1 = (System.Int32)0; System.Int32 v2 = (System.Int32)7; System.Int32 v3 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v1, (System.Int32)v2) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(7, v3,"Regression Failure? [278]"); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v6 = (System.Int32)(-1); System.Int32 v7 = (System.Int32)46; System.Int32 v8 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v6, (System.Int32)v7) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(45, v8,"Regression Failure? [279]"); System.Int32 v9 = (System.Int32)2; System.Int32 v10 = (System.Int32)(-3); System.Int32 v11 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v9, (System.Int32)v10) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-1, v11,"Regression Failure? [280]"); System.Int32 v12 = (System.Int32)1; System.Int32 v13 = (System.Int32)(-1); System.Int32 v14 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v12, (System.Int32)v13) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(0, v14,"Regression Failure? [281]"); System.Int32 v15 = (System.Int32)39; System.Int32 v16 = (System.Int32)46; System.Int32 v17 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v15, (System.Int32)v16) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(85, v17,"Regression Failure? [282]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v19 = (System.Int32)0; System.Int32 v20 = (System.Int32)(-3); System.Int32 v21 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v19, (System.Int32)v20) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-3, v21,"Regression Failure? [283]"); System.Int32 v22 = (System.Int32)0; System.Int32 v23 = (System.Int32)0; System.Int32 v24 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v22, (System.Int32)v23) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(0, v24,"Regression Failure? [284]"); /* ClassLibrary1.Class1 constructor Void .ctor() (System.Int32)0 (System.Int32)7 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)(-1) (System.Int32)46 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)2 (System.Int32)(-3) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)1 (System.Int32)(-1) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)39 (System.Int32)46 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)0 (System.Int32)(-3) ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)0 (System.Int32)0 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
public void TestMethod21() { //BEGIN TEST ClassLibrary1.Class1 v0 = new ClassLibrary1.Class1(); ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v4 = (System.Int32)(-8); System.Int32 v5 = (System.Int32)7; System.Int32 v6 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v4, (System.Int32)v5) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(-1, v6,"Regression Failure? [245]"); ((ClassLibrary1.Class1)v0).cal() ; System.Int32 v8 = (System.Int32)10; System.Int32 v9 = (System.Int32)44; System.Int32 v10 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v8, (System.Int32)v9) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(54, v10,"Regression Failure? [246]"); System.Int32 v11 = (System.Int32)105; System.Int32 v12 = (System.Int32)44; System.Int32 v13 = ((ClassLibrary1.Class1)v0).CalcSum((System.Int32)v11, (System.Int32)v12) ; //Regression assertion (captures the current behavior of the code) Assert.AreEqual<int>(149, v13,"Regression Failure? [247]"); /* ClassLibrary1.Class1 constructor Void .ctor() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() ClassLibrary1.Class1.Void cal() (System.Int32)(-8) (System.Int32)7 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) ClassLibrary1.Class1.Void cal() (System.Int32)10 (System.Int32)44 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) (System.Int32)105 (System.Int32)44 ClassLibrary1.Class1.Int32 CalcSum(Int32, Int32) */ //END TEST return; }
static void Main() { Console.WriteLine("Hello World!! This is Sophy"); Console.WriteLine("Press any key to continue"); //Console.ReadLine(); myClass c = new myClass(); //Console.ReadLine(); myEnum e = new myEnum(); Test obj = new Test(); obj.Check(); Test obj2 = new Test(200); obj2.Check(); Test obj3 = new Test(300); obj3.Check(); int i = 0; String outStr1 = Test.GetNextNameByRef(ref i); Console.WriteLine(outStr1); Console.WriteLine("ref Current value of integer i: " + i.ToString()); outStr1 = Test.GetNextNameByRef(ref i); Console.WriteLine(outStr1); Console.WriteLine("ref Current value of integer i: " + i.ToString()); outStr1 = Test.GetNextNameByRef(i); Console.WriteLine(outStr1); Console.WriteLine("Current value of integer i: " + i.ToString()); outStr1 = Test.GetNextNameByRef(i); Console.WriteLine(outStr1); Console.WriteLine("Current value of integer i: " + i.ToString()); Console.WriteLine("Previous value of integer i: " + i.ToString()); outStr1 = Test.GetNextNameByOut(out i); Console.WriteLine(outStr1); Console.WriteLine("out Current value of integer i: " + i.ToString()); outStr1 = Test.GetNextNameByOut(out i); Console.WriteLine(outStr1); Console.WriteLine("out Current value of integer i: " + i.ToString()); int x = 10; Test.Show(x); Console.WriteLine("Not Ref paramter get value from outside called method: " + x); //10 Test.Show(ref x); Console.WriteLine("Ref paramter get value from called method: " + x); //10+23=33 Test.Show(ref x); Console.WriteLine("Ref paramter get value from called method: " + x); //33+23=56 Test.Show(x); Console.WriteLine("Not Ref paramter get value from outside called method: " + x); //56 Test.Show(x); Console.WriteLine("Not Ref paramter get value from outside called method: " + x); //56 Test.ShowOut(out x); Console.WriteLine("Out paramter get value from called method: " + x); //23+23=46 value in called method Demo d = new Demo(); d.Show(); Demo d1 = new Demo(44); d1.Show(); Person p = new Person(); p.Name = "Sophy Yang"; p.State = "IA"; Console.WriteLine("Your Name is {0}", p.Name); Console.WriteLine("Your State is {0}", p.State); //p.Company = "Multi-State Lottery Association"; readOnly cannot assign value Console.WriteLine("You are working at {0}", p.Company); p.Notes = "This is the testing C#"; Console.WriteLine("Notes: {0}", p.showNotes); //Notes is writeOnly can not get it Person objPerson = new Person() { Name = "Suki Bunny", Age = 24, City = "Des Moines", State = "IA" }; Console.WriteLine("New Person Name: {0}", objPerson.Name); //Voter objVoter = new Voter(); //Console.Write("Please enter your age: "); //objVoter.Age = Convert.ToInt32(Console.ReadLine()); //Console.WriteLine("Your age is: {0} years", objVoter.Age); //d.showDateTime();//non-static class need use new to created //Demo.ShowPressedKey(); //static class, been call by name //Demo.doMath(); //static class call by name no need new //Student objStudent = new Student(); //Console.WriteLine("Please enter your marks: "); //objStudent.Marks = Convert.ToInt32(Console.ReadLine()); //Console.WriteLine("Your marks are: {0} marks", objStudent.Marks); ////Console.ReadKey(); try { Employee objEmployee = new Employee() { EmployeeId = 1001, Name = "Sophy" }; Console.WriteLine("Employee Id is: {0} and Employee Name is {1}", objEmployee.EmployeeId, objEmployee.Name); objEmployee.SetID(-30); Console.WriteLine("Employee Id is: {0} and Employee Name is {1}", objEmployee.EmployeeId, objEmployee.Name); Console.WriteLine("{1} your bonus: {0}", objEmployee.Bonus, objEmployee.Name); //Console.ReadKey(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Class1 ob = new Class1(); Console.WriteLine(ob.Display()); Console.WriteLine(ob.Print()); ob.NewMethod(); ClassLibrary1.Class1 ob_dll = new ClassLibrary1.Class1(); Console.WriteLine(ob_dll.Display()); Console.WriteLine(ob_dll.Print()); ob_dll.NewMethod(); string str = "12345"; int num = str.IntegerExtension(); Console.WriteLine("The output using extension method: {0}", num); str = "This is sophy testing, total words count is 14, total char count is 57"; num = str.WordCount(); Console.WriteLine("Total word count: {0}", num); num = str.TotalCharWithoutSpace(); Console.WriteLine("Total char count: {0}", num); //Write text to a new file // the Dispose method is invoked which automatically flushes and closes the stream. string[] lines = { "First line", "Second line", "Third line" }; string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); using (StreamWriter outputFile = new StreamWriter(Path.Combine(mydocpath, "sophyWriteLines.txt"))) { foreach (string line in lines) { outputFile.WriteLine(line); } } Console.WriteLine(mydocpath); //Append text using (StreamWriter outputfile = new StreamWriter(Path.Combine(mydocpath, "sophyWriteLines.txt"), true)) { outputfile.WriteLine("Four line"); } // Write the text asynchronously to a new file //ClassLibrary1.Class1.WriteTextAsync("hi, this is sophy writing the text asynchronously"); string val = "Hello"; val += " am "; val += "Nitin Pandit"; Console.WriteLine(val); StringBuilder val_sb = new StringBuilder(""); val_sb.Append("Hello "); val_sb.Append(" am Nitin Pandit: "); Console.WriteLine(val_sb); //Demo.DoStringStringBuilder(); string string1 = "Today is " + DateTime.Now.ToString(); Console.WriteLine(string1); string string2 = "Hi " + "This is Sophy"; string2 += " Yang"; //Console.WriteLine(string2); StringBuilder Number = new StringBuilder(100); for (int z = 0; z < 10; z++) { Number.Append(z); } //Console.WriteLine(Number); Console.WriteLine("===== Delegate Demo ====== "); TestDelegate obj_delegate = new TestDelegate(); obj_delegate.delObject("sophy"); DelegateDemo objD = new DelegateDemo(); //DelegateDemo is class, new will call default constractor objD.delObject("SophyYang"); //delObject is delegate signed by new objD.delObject2("Sukibunny"); //delObject2 is delegate signed by new Console.WriteLine("===== Delegate Demo ====== "); //pass method as parameter: delegate delmethod del1 = DelegateDemo.show; //show() is public static method, delmethod is delegate class delmethod del2 = new delmethod(DelegateDemo.display); //display is public static method delmethod del3 = objD.print; //print is not static method, so need new created object del1(); del2(); del3(); Console.WriteLine("===== multicast Delegate Demo ====== "); multidelmethod del4 = new multidelmethod(objD.plus_Method); //plus_method is not static method del4 += new multidelmethod(objD.substract_Method); //substract_method is not static method del4(20, 10); Console.WriteLine("===== Anonymous Delegate Demo ====== "); AnonymousDelMethod Display = delegate() //lambda expression { Console.WriteLine("Anonymous Delegate method"); }; Display(); Console.WriteLine("===== Event Delegate Demo ====== "); objD.MyEvent += new eventdelmethod(objD.Display); //Display is not static method //MyEvent will execuite method Display in class DelegateDemo objD.RaiseEvent(); Console.WriteLine("===== Multi Event Delegate Demo ====== "); objD.MyMultiEven += new multidelmethod(objD.Add); objD.MyMultiEven += new multidelmethod(objD.Subtract); objD.RaiseMultiEvent(30, 50); //output 80, -20 Console.WriteLine("===== Partial classes Demo ====== "); PartialClasses pc = new PartialClasses(); pc.Function1(); pc.Function2(); ExceptionDemo eDemo = new ExceptionDemo(); try { //all 2 lines below are working eDemo.ExceptionMethod(); //eDemo.AnotherMethod(); } catch (Exception ex) { //all 3 lines below are working //throw ex; //throw new ApplicationException("Sophy's exception could not get data", ex); Console.WriteLine("throw Sophy's exception (" + ex.Message + ")"); } string[] strArr = new string[1]; eDemo.SophyExceptionArgumentDemo(strArr); strArr[0] = "2"; eDemo.SophyExceptionArgumentDemo(strArr); i = 123456; Console.WriteLine("{0:C}", i); // $123,456.00 Currency Console.WriteLine($"{i:C}"); //$ Console.WriteLine("{0:D}", i); // 123456 Decimal Console.WriteLine("{0:E}", i); // 1.234560E+005 Exponent Console.WriteLine("{0:F}", i); // 123456.00 Fixed point Console.WriteLine("{0:G}", i); // 123456 General Console.WriteLine("{0:N}", i); // 123,456.00 Currency Console.WriteLine("{0:P}", i); // 12,345,600.00 % Console.WriteLine("{0:X}", i); // 1E240 Hex i = 123456; Console.WriteLine(); Console.WriteLine("{0:#0}", i); // 123456 Console.WriteLine("{0:#0;(#0)}", i); // 123456 Console.WriteLine("{0:#0;(#0);}", i); // 123456 Console.WriteLine("{0:#%}", i); // 12345600% i = -123456; Console.WriteLine(); Console.WriteLine("{0:#0}", i); // -123456 Console.WriteLine("{0:#0;(#0)}", i); // (123456) Console.WriteLine("{0:#0;(#0);}", i); // (123456) Console.WriteLine("{0:#%}", i); // -12345600% i = 0; Console.WriteLine(); Console.WriteLine("{0:#0}", i); // 0 Console.WriteLine("{0:#0;(#0)}", i); // 0 Console.WriteLine("{0:#0;(#0);}", i); // Console.WriteLine("{0:#%}", i); // % MultiDeleTest md = new MultiDeleTest(); Class1 c1 = new Class1(); Class2 c2 = new Class2(); DelegateDemo c3 = new DelegateDemo(); IsTest.Test(c1); IsTest.Test(c2); IsTest.Test(c3); IsTest.Test("Passing String Value instead of class"); IsTest.asTest(); Demo.NullableDemo(); CompareTwoClass compareTwoClass = new CompareTwoClass(); //CompareTwoClassTest is static so don't need keywork "new" to call it AClass aclass = new AClass(); //AClass is not static so need use keywork "new" BClass bclass = new BClass(); aclass.AMethod(); bclass.AMethod(); bclass.B2Method(); bclass.B3Method(); bclass.B4Method(); Console.WriteLine(bclass.GetHashCode()); //return 21083178 DataTypeConversion dataTypeConversion = new DataTypeConversion(); BoxingUnboxing boxingUnboxing = new BoxingUnboxing(); StructDemo structDemo = new StructDemo(); //StructDemo structDemo1 = new StructDemo(10,10); StructDemo structDemo1; //don't need use new keywork to create a object structDemo1.x = 10; structDemo1.y = 20; Console.WriteLine($"Struct Demo 1: x = {structDemo.x} y = {structDemo.y }"); Console.WriteLine($"Struct Demo 2: x = {structDemo1.x} y = {structDemo1.y }"); StructurePerson strX = new StructurePerson(); //structure is value type StructurePerson strY = new StructurePerson(); strX.FirstName = "Sophy"; strX.LastName = "Yang"; strY.FirstName = "Sophy"; strY.LastName = "Yang"; if (strX.Equals(strY)) { Console.WriteLine("strX = strY"); //will return this, struct is value type } else { Console.WriteLine("strX != strY"); } ClassPerson clsX = new ClassPerson(); //class is reference type, object 1 ClassPerson clsY = new ClassPerson(); //class is reference type, object 2 ClassPerson clsZ = clsX; //clsZ is assigned to object clsX clsX.FirstName = "Sophy"; clsX.LastName = "Yang"; clsY.FirstName = "Sophy"; clsY.LastName = "Yang"; if (clsX.Equals(clsY)) { Console.WriteLine("clsX = clsY"); } else { Console.WriteLine("clsX != clsY"); //will return this, class is reference type } clsX.FirstName = "Michael"; if (clsX.Equals(clsZ)) { Console.WriteLine("clsX = clsZ"); //will return this, since clsZ assigned object clsX } else { Console.WriteLine("clsX != clsZ"); } Cinterface.InterfaceTest(); //in interface1.cs public static method Square.AbstractDemoTest(); //in AbstractDemo.cs public static method DerivedClass.DerivedClassTest(); //in AbstractDemo.cs public static method Bike.BikeTest(); //in AbstractDemo.cs public static method B.InterfaceTest(); EnumDemo.EnumDemoTest(); refVSout.refVSoutTest(); EmployeeTest.EmployeeDemo(); StudentTest.StudentTestDemo(); p.FistName = "MyFirstName"; p.LastName = "MyLastName"; Console.WriteLine("My full name is {0}", p.FullName); //p.FullName = "Sophy Yang"; read only cannot assigned value, only has get no set try { p.FistName = null; p.LastName = "Yang"; Console.WriteLine("My full name is {0} ", p.FullName); } catch (Exception ex) { Console.WriteLine(ex.Message); } ExtensionMethodDemoTest.ExtemsionMethod(); StringVsStringBuilder s_sb = new StringVsStringBuilder(); //DelegateDemo delegateDemo = new DelegateDemo(); SealedClassTest sealedClassTest = new SealedClassTest(); SealedClassDemo sealedClassDemo = new SealedClassDemo(); sealedClassDemo.Add(6, 9); SealedClassTest.runSealedClass(); //static method cannot access by new keyword object SimpleDelegate simpleDelegate = new SimpleDelegate(); simpleDelegate.NameDemo(); Console.WriteLine("Name: " + p.Name); p.Address1 = "1100 Locust Street"; p.Address2 = "Suit 100"; p.City = "Des Moines"; p.Zip = 50309; Console.WriteLine(p.SecondHomeAddress()); Console.WriteLine(p.CompanyAddress()); Console.WriteLine(""); Console.WriteLine(""); IEnumerableDemo ie = new IEnumerableDemo(); YieldReturnDemo yr = new YieldReturnDemo(); LateBindingEarlyBinding lbeb = new LateBindingEarlyBinding(); //ManyToManyEfSample2 mtm2 = new ManyToManyEfSample2(); //has error ConflictingMethodName cfMethod = new ConflictingMethodName(); int xO = 5; int yO = xO / 10; Console.WriteLine("5/10=" + yO); yO = xO % 10; Console.WriteLine("5%10=" + yO); List <string> list = new List <string>(); list.Add("a"); list.Add("b"); list.Add("c"); string result = list.Find(item => item == "a"); if (list.Find(item => item == "a") is null) { Console.WriteLine("Not Find in List item: "); } else { Console.WriteLine("Find List item: " + result); } string s = "abcabcbb"; int largeCount = 0; string largeStr = string.Empty; int i1; for (i1 = 0; i1 < s.Length; i1++) { List <string> l = new List <string>(); int count = 0; string str1 = string.Empty; for (int j = i1; j < s.Length; j++) { string s1 = s.Substring(j, 1); if (l.Find(item => item == s1) is null) { l.Add(s.Substring(j, 1)); count += 1; str1 += s1; Console.WriteLine("The large string lenght is " + largeCount + " (" + l.Count + ") " + count); } i1 = j; if (largeCount < count) { largeCount = i1; largeStr = str1; } } } Console.WriteLine("The large string lenght is " + largeCount + " (" + largeStr + ") "); Console.WriteLine("0%2=" + 0 % 2); LeetCode le = new LeetCode(); Console.ReadLine(); }