public void ConfigureServices(IServiceCollection services) { var mowingMachine = new MowingMachine(TestTimer.Instance) { Orientation = "North", Position = new Position() { Length = 0, Width = 0 } }; services.AddSingleton(mowingMachine); var lawn = new Lawn() { Length = 5, Width = 5 }; services.AddSingleton(lawn); var navigator = new Navigator(mowingMachine, lawn); navigator.StartNavigation(); services.AddSingleton(navigator); var controllersAssembly = Assembly.Load(new AssemblyName("GardenGizmos.SLMM")); services.AddMvc() .AddApplicationPart(controllersAssembly) .AddControllersAsServices() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public void Execute(MowingMachine mowingMachine, Lawn lawn) { var position = mowingMachine.NextPositionInDirection(); if (lawn.PositionWithinBounds(position)) { mowingMachine.MoveTo(position); } }
public void ConfigureServices(IServiceCollection services) { var mowingMachine = new MowingMachine(new SleepTimer()) { Position = new Position() }; Configuration.GetSection("MowingMachine").Bind(mowingMachine); services.AddSingleton(mowingMachine); var lawn = new Lawn(); Configuration.GetSection("Lawn").Bind(lawn); services.AddSingleton(lawn); var navigator = new Navigator(mowingMachine, lawn); navigator.StartNavigation(); services.AddSingleton(navigator); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public void Execute(MowingMachine mowingMachine, Lawn lawn) { mowingMachine.TurnAntiClockwise(); }
public Navigator(MowingMachine mowingMachine, Lawn lawn) { _mowingMachine = mowingMachine; _lawn = lawn; }