public static int Main(string[] args) { // Check args if (args.Length != 2) { Console.WriteLine("USAGE: SemaphoreCtor1 /iCount:<int> /mCount:<int>"); return(-1); } // Get the args int iCount = -1, mCount = -1; for (int i = 0; i < args.Length; i++) { if (args[i].ToLower().StartsWith("/icount:")) { iCount = Convert.ToInt32(args[i].Substring(8)); continue; } if (args[i].ToLower().StartsWith("/mcount:")) { mCount = Convert.ToInt32(args[i].Substring(8)); continue; } } CtorTest ct = new CtorTest(); return(ct.Run(iCount, mCount)); }
public static int Main(string[] args) { // Check args if (args.Length < 2) { Console.WriteLine("USAGE: SemaphoreCtor2 /iCount:<int> /mCount:<int> " + "[/semName:<string>] [/iRandom:<int>]"); return(-1); } // Get the args int iCount = -1, mCount = -1, iRandom = -1; string semName = "DefaultString"; for (int i = 0; i < args.Length; i++) { if (args[i].ToLower().StartsWith("/icount:")) { iCount = Convert.ToInt32(args[i].Substring(8)); continue; } if (args[i].ToLower().StartsWith("/mcount:")) { mCount = Convert.ToInt32(args[i].Substring(8)); continue; } if (args[i].ToLower().StartsWith("/irandom:")) { iRandom = Convert.ToInt32(args[i].Substring(9)); continue; } if (args[i].ToLower().StartsWith("/semname:")) { semName = args[i].Substring(9); if (semName.ToLower() == "null") { semName = null; } continue; } if (args[i].ToLower().StartsWith("/unisemname:")) { semName = string.Empty; // Convert to unicode string[] s = args[i].Substring(12).Split(';'); foreach (string str in s) { semName += Convert.ToChar(Convert.ToInt32(str)); } continue; } } CtorTest ct = new CtorTest(); return(ct.Run(iCount, mCount, semName, iRandom)); }
public static int Main(string[] args) { // Check args if (args.Length != 2) { Console.WriteLine("USAGE: SemaphoreCtor1 /iCount:<int> /mCount:<int>"); return -1; } // Get the args int iCount = -1, mCount = -1; for (int i = 0; i < args.Length; i++) { if (args[i].ToLower().StartsWith("/icount:")) { iCount = Convert.ToInt32(args[i].Substring(8)); continue; } if (args[i].ToLower().StartsWith("/mcount:")) { mCount = Convert.ToInt32(args[i].Substring(8)); continue; } } CtorTest ct = new CtorTest(); return ct.Run(iCount, mCount); }
public static int Main(string[] args) { // Check args if (args.Length < 3) { Console.WriteLine("USAGE: SemaphoreCtorNeg3 /iCount:<int> /mCount:<int> " + "[/semName:<string>] [/iRandom:<int>]"); return -1; } // Get the args int iCount = -1, mCount = -1, iRandom = -1; string semName = "DefaultString"; for (int i = 0; i < args.Length; i++) { if (args[i].ToLower().StartsWith("/icount:")) { iCount = Convert.ToInt32(args[i].Substring(8)); continue; } if (args[i].ToLower().StartsWith("/mcount:")) { mCount = Convert.ToInt32(args[i].Substring(8)); continue; } if (args[i].ToLower().StartsWith("/irandom:")) { iRandom = Convert.ToInt32(args[i].Substring(9)); continue; } if (args[i].ToLower().StartsWith("/semname:")) { semName = args[i].Substring(9); if (semName.ToLower() == "null") semName = null; continue; } if (args[i].ToLower().StartsWith("/unisemname:")) { semName = string.Empty; // Convert to unicode string[] s = args[i].Substring(12).Split(';'); foreach (string str in s) semName += Convert.ToChar(Convert.ToInt32(str)); continue; } } CtorTest ct = new CtorTest(); return ct.Run(iCount, mCount, semName, iRandom); }
public void Constructor() { var o1 = new CtorTest(); Equal(o1.OriginalValue, 1); Equal(o1.Value, 2); var o2 = new CtorTest(3); Equal(o2.OriginalValue, 1); Equal(o2.Value, 3); var o3 = new CtorTest() { Value = 4 }; Equal(o3.OriginalValue, 1); Equal(o3.Value, 4); }