/// <summary> /// The main method. /// </summary> /// <param name="args">Command line arguments that are ignored.</param> private static void Main(String[] args) { var inputNode2 = new OnlyOutput(); var splitterNode1 = new Splitter(); var maxNode1 = new MaxFinder(); var splitterNode2 = new Splitter(); var maxNode2 = new MaxFinder(); var outputNode1 = new LogicConsoleWriter <byte>(); var outputNode2 = new LogicConsoleWriter <byte>(); inputNode2.ConnectToHead(0, splitterNode1, 0); splitterNode1.ConnectToHead(0, maxNode1, 1); splitterNode1.ConnectToHead(1, maxNode2, 1); maxNode1.ConnectToHead(0, splitterNode2, 0); splitterNode2.ConnectToHead(2, maxNode1, 0); splitterNode2.ConnectToHead(0, maxNode2, 0); splitterNode2.ConnectToHead(1, outputNode1, 0); maxNode2.ConnectToHead(0, outputNode2, 0); Graph graph = new Graph(); graph.AddNode(inputNode2); graph.AddNode(splitterNode1); graph.AddNode(splitterNode2); graph.AddNode(maxNode1); graph.AddNode(maxNode2); graph.AddNode(outputNode1); graph.AddNode(outputNode2); inputNode2.SetOutput(13); graph.Step(); inputNode2.SetOutput(32); graph.Step(); graph.Step(); }
public void MaxOfThree() { var max1 = MaxFinder.GetMaxOfThree(1, 15, 9); // Можно было бы выделить 2 тест кейса. Assert.AreEqual(max1, 15); var max2 = MaxFinder.GetMaxOfThree( new DateTime(1998, 1, 28), new DateTime(1995, 1, 28), new DateTime(1997, 1, 28)); Assert.AreEqual(max2, new DateTime(1998, 1, 28)); }
static void Main(string[] args) { //ApplicationDomain.DomainInfo(); Console.Clear(); //ApplicationDomain.WorkWithDomain(); Console.Clear(); //ThreadInfo.SimpleThread(); Console.Clear(); //FewThread.StartFewThread(); Console.Clear(); //FewThread.StartFewThreadWithParameters(); Console.Clear(); //MultyParametersThread.StartMultyParametersThread(); Console.Clear(); //MultyParametersThreadBest counter = new MultyParametersThreadBest(1, 4); //Thread myThread = new Thread(new ThreadStart(counter.Count)); //myThread.Start(); Console.Clear(); //SyncThreadBad.RunFewThreads(); Console.Clear(); //SyncThreadBest.RunFewThreads(); Console.Clear(); //ThreadJoin.Start(); Console.Clear(); //SyncThreadMonitor.RunFewThreads(); Console.Clear(); //TickTock tt = new TickTock(); //TickTockThread mt1 = new TickTockThread("Tick", tt); //TickTockThread mt2 = new TickTockThread("Tock", tt); //mt1.thrd.Join(); //mt2.thrd.Join(); //Console.WriteLine("Clock stopped"); //Console.ReadLine(); Console.Clear(); //IncThread mt1 = new IncThread("Inc thread", 5); // разрешить инкременирующему потоку начаться //Thread.Sleep(1); //DecThread mt2 = new DecThread("Dec thread", 5); //mt1.Thrd.Join(); //mt2.Thrd.Join(); //Console.ReadLine(); //Console.Clear(); //SemaphoreSync.Run(); //Console.Clear(); //App.Run(); int[] numbers = { 2, 172, 1, 77, 3, 91, 23, 73, 6, 3, 11, 384, 5 }; MaxFinder finder = new MaxFinder(numbers); Console.WriteLine(finder.FindMax()); Console.ReadLine(); }