public void Ensure_FleetService_LoadFleet_Formats_Re() { var repo = A.Fake<IFileRepository>(); var logger = A.Fake<ILogger>(); var liines = new List<string>() { "{0}{1}".FormatLiteralArguments("1, M1, 5, 0,0,0,0,0",Constants.CaridgeReturn), "{0}{1}".FormatLiteralArguments("2, M2, 3, 1,0,0",Constants.CaridgeReturn), "{0}{1}".FormatLiteralArguments("3, M3, 5, 1,1,1,1,1",Constants.CaridgeReturn) }; var loadedFile = new StringBuilder(); liines.ForEach((line) => { loadedFile.Append(line); }); var fleetService = new FleetService(repo, logger); A.CallTo(()=>repo.LoadFile(null)).WithAnyArguments().Returns(loadedFile.ToString()); var request = new FleetRequest("Test path"); var result = fleetService.LoadFleet(request); Assert.AreEqual(result.Hosts.Count(), liines.Count); Assert.IsFalse(result.Notifications.HasErrors); }
public FleetServiceTests() { _context = InMemoryContextBuilder.GetContext(); _clubId = _context.Clubs.First().Id; _mapper = MapperBuilder.GetSailScoresMapper(); _service = new FleetService( _context, _mapper); }
public void Ensure_FleetService_LoadFleet_Guards_The_Result_FileName() { var repo = A.Fake<IFileRepository>(); var logger = A.Fake<ILogger>(); var fleetService = new FleetService(repo, logger); var request = new FleetRequest(null); var result = fleetService.LoadFleet(request); }
public void Ensure_FleetService_LoadFleet_LogsError_If_Loaded_File_IsNullOrEmpty() { var repo = A.Fake<IFileRepository>(); var logger = A.Fake<ILogger>(); var fleetService = new FleetService(repo, logger); A.CallTo(() => repo.LoadFile(null)).WithAnyArguments().Returns(null); var request = new FleetRequest("Test path"); var result = fleetService.LoadFleet(request); Assert.IsTrue(result.Notifications.HasErrors); A.CallTo(() => logger.Error(null)).WithAnyArguments().MustHaveHappened(); }
static void Main(string[] args) { Console.WriteLine("Tranport.ly"); // dependencies IOrderService orderService = new OrderService(); IFleetService fleetService = new FleetService(); var inventoryManager = new InventoryManager(orderService, fleetService); // User story 1 inventoryManager.ListFlightSchedule(); // User story 2 inventoryManager.GenerateFlightItineraries(); }
public FleetResult LoadFleetStatus(FleetRequest request) { var result = new FleetResult(); try { result = FleetService.LoadFleet(request); } catch (Exception ex) { Logger.Error(ex); result.Notifications.Add(GeneralError); } return(result); }
public FleetsController(FSXAPIDBContext context) { _service = new FleetService(context); }
public MainViewModel(FleetService fleetService) { _fleetService = fleetService; }