public void FindSum_Test() { foreach (var tc in GetFindSumTestCases()) { Assert.AreEqual(tc.ExpectedPaths, BinaryTreeService.GetSumPaths(tc.Root, tc.Sum)); } }
public void IsSubtreeOf_Test() { foreach (var tc in GetSubTreeTestCases()) { Assert.AreEqual(tc.IsSubtreeOf, BinaryTreeService.IsSubtreeOf(tc.FirstTree, tc.SecondTree)); } }
public BinaryTreeController() { if (_BinaryTreeRepository == null) { _BinaryTreeRepository = new BinaryTreeService(); } }
public void FindFirstCommonAncestor_WithParentLink_Test() { var testCases = GetCommonAncestorTestCases(); foreach (var testCase in testCases) { Assert.AreEqual(testCase.FirstCommonAncestor, BinaryTreeService.FindFirstCommonAncestor(testCase.Node1, testCase.Node2)); } }
static void Main(string[] args) { Console.WriteLine(string.Format("ed = {0}, Tom = {1}", "cool", "less cool")); //SRP Console.WriteLine("SRP"); UserStorage s = new UserStorage(); EmailStorage e = new EmailStorage(); SRPService main = new SRPService(s, e); Console.WriteLine("_________________________________"); Console.WriteLine("OCP"); //OCP OCPService ocp = new OCPService(); Console.WriteLine("_________________________________"); Console.WriteLine("LSP"); //LSP LSPService lsp = new LSPService(); Console.WriteLine("_________________________________"); Console.WriteLine("ISP"); //ISP ISPService isp = new ISPService(); Console.WriteLine("_________________________________"); Console.WriteLine("DIP"); //DIP DIPService sip = new DIPService(); Console.WriteLine("_________________________________"); Console.WriteLine("Law of Demeter"); //Law of demeter Demeter dim = new Demeter(); Console.WriteLine("_________________________________"); Console.WriteLine("Factory pattern"); //factory FactoryService factory = new FactoryService(); Console.WriteLine("_________________________________"); Console.WriteLine("Adaptor Pattern"); //Adaptor pattern AdaptorService adaptorService = new AdaptorService(); Console.WriteLine("_________________________________"); Console.WriteLine("Decorator Pattern"); //decorator pattern DecoratorService decoratorService = new DecoratorService(); Console.WriteLine("_________________________________"); Console.WriteLine("Repository Pattern"); //Repository pattern RepositoryService RepositoryService = new RepositoryService(); Console.WriteLine("_________________________________"); Console.WriteLine("Tree Traversal"); //BinaryTree Traversal BinaryTreeService BinaryTreeService = new BinaryTreeService(); Console.WriteLine("_________________________________"); Console.WriteLine("Number Swap"); //Number Swap NumberSwapService NumberSwapService = new NumberSwapService(); Console.WriteLine("_________________________________"); Console.WriteLine("Multiply"); //Multiply MultiplyService MultiplyService = new MultiplyService(); Console.WriteLine("_________________________________"); Console.WriteLine("OverflowChecked"); //OverflowCheckedService OverflowCheckedService OverflowChecked = new OverflowCheckedService(); Console.WriteLine("_________________________________"); Console.WriteLine("By Ref"); //pass by reference ByRefService ByRefService = new ByRefService(); Console.WriteLine("_________________________________"); Console.WriteLine(" EF Code FirstService"); //EFCodeFirstService //EFCodeFirstService EFCodeFirstService = new EFCodeFirstService(); Console.WriteLine("_________________________________"); //read Console.ReadLine(); }
public BinaryTreeTests() { _service = new BinaryTreeService(); }