public Rover(ILocationValidator locationValidator) { this.locationValidator = locationValidator; movementMethodDictionary = new Dictionary <Movement, Action> { { Movement.Left, () => leftMoveDictionary[Direction].Invoke() }, { Movement.Right, () => rightMoveDictionary[Direction].Invoke() }, { Movement.Forward, () => forwardMoveDictionary[Direction].Invoke() } }; leftMoveDictionary = new Dictionary <Direction, Action> { { Direction.North, () => Direction = Direction.West }, { Direction.East, () => Direction = Direction.North }, { Direction.South, () => Direction = Direction.East }, { Direction.West, () => Direction = Direction.South } }; rightMoveDictionary = new Dictionary <Direction, Action> { { Direction.North, () => Direction = Direction.East }, { Direction.East, () => Direction = Direction.South }, { Direction.South, () => Direction = Direction.West }, { Direction.West, () => Direction = Direction.North } }; forwardMoveDictionary = new Dictionary <Direction, Action> { { Direction.North, () => { preLocation = new Location(Location.X, Location.Y + 1); } }, { Direction.East, () => { preLocation = new Location(Location.X + 1, Location.Y); } }, { Direction.South, () => { preLocation = new Location(Location.X, Location.Y - 1); } }, { Direction.West, () => { preLocation = new Location(Location.X - 1, Location.Y); } } }; }
public void CreateNewLocationServiceOfTypeILocationService_WithNullAsILocationValidator_ThrowsNullReferenceException() { ILocationRepository locationRepository = new Mock <ILocationRepository>().Object; ILocationValidator validator = null as LocationValidator; Action action = () => new LocationService(locationRepository, validator); action.Should().Throw <ParameterCannotBeNullException>().WithMessage("LocationValidator Parameter Can't be null"); }
public Location CreateVerify( ILocationRepository locationRepository = null, ILocationValidator validator = null) { locationRepository ??= new Mock <ILocationRepository>().Object; validator ??= new Mock <ILocationValidator>().Object; var service = new LocationService(locationRepository, validator) as ILocationService; var location = _locationEntityTestHelper.ValidLocation(); service.Create(location); return(location); }
public void CreateInvalid <T>( ILocationRepository repository = null, ILocationValidator validator = null, Location location = null, string message = null) where T : Exception { Action action = () => LocationService(repository, validator).Create(location); if (message != null) { action.Should().Throw <T>() .And.Message.Should().Be(message); } else { action.Should().Throw <T>(); } }
public CommandFactory(ILocationValidator locationValidator) { this.locationValidator = locationValidator; }
public GeolocationController(IGeolocationDetailsManager detailsManager, ILocationValidator locationValidator) { this.detailsManager = detailsManager; this.locationValidator = locationValidator; }
public LocationService(ILocationQuery locationQuery, ILocationRepository locationRepository, ILocationValidator locationValidator) { _locationQuery = locationQuery; _locationRepository = locationRepository; _locationValidator = locationValidator; }
public LandingCommand(ILocationValidator locationValidator, Location location, Direction direction) { this.locationValidator = locationValidator; this.Location = location; this.Direction = direction; }
public LocationService(ILocationRepository locationRepository, ILocationValidator locationValidator) { _locationRepository = locationRepository ?? throw new ParameterCannotBeNullException("LocationRepository"); _locationValidator = locationValidator ?? throw new ParameterCannotBeNullException("LocationValidator"); }
private ILocationService LocationService( ILocationRepository repository = null, ILocationValidator validator = null) { return(new LocationService(repository, validator)); }