static void Main(string[] args) { #region none Husky AHusky = new Husky("hah", "#000"); AHusky.OnStartBark += AHusky_OnStartBark; AHusky.OnEndBark += AHusky_OnEndBark; AHusky.Bark(); var temp = new WebLengthClass(); Console.ReadKey(); #endregion }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Beagle beagle = new Beagle(); Console.WriteLine(beagle.IsHunter); Console.WriteLine(beagle.DoTrick()); Console.WriteLine(beagle.EatFood()); Console.WriteLine(beagle.FormsGroup()); Console.WriteLine(beagle.MakesBabies()); Console.WriteLine(beagle.LearnTrick()); Husky husky = new Husky(); Console.WriteLine(husky.LovesSnow); Console.WriteLine(husky.DoTrick()); Console.WriteLine(husky.EatFood()); Console.WriteLine(husky.FormsGroup()); Console.WriteLine(husky.MakesBabies()); Console.WriteLine(husky.LearnTrick()); Chimpanzee chimp = new Chimpanzee(); Console.WriteLine(chimp.HasHeart); Console.WriteLine(chimp.NumberOfLegs); Console.WriteLine(chimp.EatFood()); Console.WriteLine(chimp.FormsGroup()); Console.WriteLine(chimp.MakesBabies()); Console.WriteLine(beagle.MakeSound()); Dolphin dolphin = new Dolphin(); Console.WriteLine(dolphin.HasHeart); Console.WriteLine(dolphin.BreathesAir); Console.WriteLine(dolphin.HasScales); Console.WriteLine(dolphin.DoTrick()); Console.WriteLine(dolphin.EatFood()); Console.WriteLine(dolphin.EatsHumans()); Console.WriteLine(dolphin.MakesBabies()); Console.WriteLine(dolphin.MakeSound()); Shark shark = new Shark(); Console.WriteLine(shark.HasHeart); Console.WriteLine(shark.BreathesAir); Console.WriteLine(shark.HasScales); Console.WriteLine(shark.EatFood()); Console.WriteLine(shark.EatsHumans()); Console.WriteLine(shark.MakeSound()); }
public static void Main(string[] args) { Console.WriteLine("----------- Strategy Pattern ------------"); var husky = new Husky(); husky.Bark(); husky.Run(); husky.SetBarkBehavior(new BarkElectronical()); husky.Bark(); Console.WriteLine("----------- Singleton ------------"); var bankValues1 = BankValues.GetInstance(); var bankValues2 = BankValues.GetInstance(); Console.WriteLine(bankValues1 == bankValues2 ? "Oh yes, I am the same instance" : "Nope, I am another BankValue instance."); Console.WriteLine("----------- Factory Method ------------"); var shop = new SoftwareShop().GetProgram(OfficeProg.Powerpoint); Console.WriteLine("----------- Facade ------------"); var officeTask = new OfficeFacade(); officeTask.PrintDocument(); Console.WriteLine("----------- State ------------"); var lumpi = new Doggy(); lumpi.Play(); lumpi.Anger(); lumpi.GiveMeal(); lumpi.Stroke(); lumpi.LeaveAlone(); Console.WriteLine("----------- DI with Autofac ------------"); var container = ContainerConfig.Configure(); using (var scope = container.BeginLifetimeScope()) { var app = scope.Resolve <IApplication>(); app.Run(); } Console.WriteLine("----------- Repository ------------"); ArticleRepository artRepo = new ArticleRepository(); List <Article> artList = artRepo.ReadAll(); Console.WriteLine($"Found {artList.Count} articles in the List"); artRepo.Create(new Article { }); var artLatest = artRepo.ReadLatest(); Console.WriteLine($"Title: {artLatest.Title}, ID: {artLatest.Id}"); artList = artRepo.ReadAll(); Console.WriteLine($"Found {artList.Count} articles in the List"); artRepo.Update(new Article { }); Console.WriteLine($"FOUND: {artRepo.ReadById(1).Title}"); artRepo.Delete(new Article { }); artList = artRepo.ReadAll(); Console.WriteLine($"Found {artList.Count} articles in the List"); }