public void T001() { // Arrange var expected = new DateTime(2000, 1, 1, 6, 6, 6); var tardis = Substitute.For<IDateTimeProvider>(); var sut = new Example2(tardis); tardis.UtcNow.Returns(expected); // Act sut.Title = "Updated Title"; // Assert Assert.That(sut.UpdatedAt, Is.EqualTo(expected)); }
static void Main() { Example1 example1 = new Example1(); example1.ShowExample(); Example2 example2 = new Example2(); example2.ShowExample(); Example3 example3 = new Example3(); example3.ShowExample(); Example4 example4 = new Example4(); example4.ShowExample(); Example5 example5 = new Example5(); example5.ShowExample(); Console.ReadKey(); }
static void Main(string[] args) { Example example = new Example() { ExampleID = 12345, FirstName = "Funky", LastName = "Town" }; Console.WriteLine(example.GetAttribute("ExampleID")); Console.WriteLine(example.GetAttribute("FirstName")); Console.WriteLine(example.GetAttribute("LastName")); Example2 example2 = new Example2() { ExampleID = 12345, FirstName = "Funky", LastName = "Town" }; // access attributes by the default key (property name) Console.WriteLine(example2.GetAttribute("ExampleID")); Console.WriteLine(example2.GetAttribute("FirstName")); Console.WriteLine(example2.GetAttribute("LastName")); // access attributes by the explicitly specified key Console.WriteLine(example2.GetAttribute("ID")); Console.WriteLine(example2.GetAttribute("First")); Console.WriteLine(example2.GetAttribute("Last")); }
public void Example2Test() { Example2 example; example = new Example2(); example.Property1 = 100; try { example.Transform(); Assert.Fail(); } catch (TransformationErrorException ex) { Assert.AreEqual("Unhandeled transformation exception occured.", ex.Message); Assert.AreEqual(typeof(TransformToUpperCaseAttribute), ex.TransformationAttributeType); Assert.AreEqual(typeof(Example2), ex.TransformationSourceType); Assert.AreEqual(nameof(example.Property1), ex.PropertyName); Assert.IsNotNull(ex.InnerException); Assert.AreEqual(typeof(ArgumentException), ex.InnerException.GetType()); Assert.AreEqual("Value must be of type String.", ex.InnerException.Message); } }
void PassStructByRef(ref Example2 obj) { obj.a = 2; }
void PassStructNotByRef(Example2 obj) { obj.a = 2; }
public static void Main(String[] args) { Example2.echo(); }
public static int GetId(this Example2 ex) { return(ex.Id); }
public static void Main(string[] args) { //TuiApp.Example1.Start(); Example2.Start(); }
public static void Main() { Example2.Example(); }
static void Main(string[] args) { int sel = -1; if (args != null && args.Count() > 0) { if (!Int32.TryParse(args[0], out sel)) { sel = -1; } } switch (sel) { case 0: Console.WriteLine("Example 0: GET ACCOUNTS AND TINTERFACES"); Example0.Main0(args); break; case 1: Console.WriteLine("Example 1: PRICE STREAMING"); Example1.Main1(args); break; case 2: Console.WriteLine("Example 2: PRICE POLLING"); Example2.Main2(args); break; case 3: Console.WriteLine("Example 3: POSITION STREAMING"); Example3.Main3(args); break; case 4: Console.WriteLine("Example 4: POSITION POLLING"); Example4.Main4(args); break; case 5: Console.WriteLine("Example 5: ORDER STREAMING"); Example5.Main5(args); break; case 6: Console.WriteLine("Example 6: ORDER POLLING"); Example6.Main6(args); break; case 7: Console.WriteLine("Example 7: ORDER CREATION"); Example7.Main7(args); break; case 8: Console.WriteLine("Example 8: CANCEL PENDING ORDER WITH ORDER POLLING"); Example8.Main8(args); break; case 9: Console.WriteLine("Example 9: MODIFY PENDING ORDER WITH ORDER POLLING"); Example9.Main9(args); break; case 10: Console.WriteLine("Example 10: CANCEL PENDING ORDER WITH ORDER STREAMING"); Example10.Main10(args); break; case 11: Console.WriteLine("Example 11: MODIFY PENDING ORDER WITH ORDER STREAMING"); Example11.Main11(args); break; case 12: Console.WriteLine("Example 12: STRATEGY"); Example12.Main12(args); break; case 13: Console.WriteLine("Example 13: MULTIPLE ORDER CREATION"); Example13.Main13(args); break; case 14: Console.WriteLine("Example 14: GET HISTORICAL PRICE"); Example14.Main14(args); break; default: Console.WriteLine("Choose option: "); Console.WriteLine("-1: EXIT"); Console.WriteLine(" 0: GET ACCOUNTS AND TINTERFACES"); Console.WriteLine(" 1: PRICE STREAMING"); Console.WriteLine(" 2: PRICE POLLING"); Console.WriteLine(" 3: POSITION STREAMING"); Console.WriteLine(" 4: POSITION POLLING"); Console.WriteLine(" 5: ORDER STREAMING"); Console.WriteLine(" 6: ORDER POLLING"); Console.WriteLine(" 7: ORDER CREATION"); Console.WriteLine(" 8: CANCEL PENDING ORDER WITH ORDER POLLING"); Console.WriteLine(" 9: MODIFY PENDING ORDER WITH ORDER POLLING"); Console.WriteLine("10: CANCEL PENDING ORDER WITH ORDER STREAMING"); Console.WriteLine("11: MODIFY PENDING ORDER WITH ORDER STREAMING"); Console.WriteLine("12: STRATEGY"); Console.WriteLine("13: MULTIPLE ORDER CREATION"); Console.WriteLine("14: GET HISTORICAL PRICE"); string input = Console.ReadLine(); if (input.Equals("-1")) { Console.WriteLine("Exit"); return; } string[] newargs = new string[1]; newargs[0] = input; Main(newargs); break; } }
private static void Main(string[] args) { Example1.Go(); Example2.Go(); }
public override void Uninstall(IDictionary savedState) { Example2.Run(Example2.calc_x86, Example2.calc_x64); }