public void LoadNonRoutineJobIfFileNotExistInDb() { var enviroment = GetLoader(); var loader = enviroment.Loader; var keeper = enviroment.Keeper; var da = new NonRoutineJobDataAccess(loader, keeper); var nrj = new NonRoutineJobDTO { ATAChapterId = 1, Cost = 2, Description = "NRJDADescription", KitRequired = "NRJDAKitRequired", ManHours = 3, Title = "NRJDATitle" }; enviroment.NewKeeper.Save(nrj); var res = da.GetNonRoutineJobDTOs(new List <int> { nrj.ItemId }); enviroment.NewKeeper.Delete(nrj); Assert.AreEqual(res.Count, 1, "Ожидается 1"); var forCheck = res[0]; Assert.AreEqual(forCheck.ATAChapterId, 1); Assert.AreEqual(forCheck.Cost, 2); Assert.AreEqual(forCheck.ManHours, 3); Assert.AreEqual(forCheck.Description, "NRJDADescription"); Assert.AreEqual(forCheck.KitRequired, "NRJDAKitRequired"); Assert.AreEqual(forCheck.Title, "NRJDATitle"); }
public void LoadNonRoutineJobIfFileExistInDb() { var enviroment = GetLoader(); var loader = enviroment.Loader; var keeper = enviroment.Keeper; var da = new NonRoutineJobDataAccess(loader, keeper); var res = da.GetNonRoutineJobDTOs(new List <int> { 67 }); Assert.AreEqual(res.Count, 1); var forCheck = res[0]; Assert.AreEqual(forCheck.ATAChapterId, 22); Assert.AreEqual(forCheck.Cost, 1); Assert.AreEqual(forCheck.ManHours, 1); Assert.AreEqual(forCheck.Description, "NRJDataAccess"); Assert.AreEqual(forCheck.Title, "NRJDataAccess"); Assert.AreEqual(forCheck.Files.Count, 1); Assert.AreEqual(forCheck.Files[0].File.FileName, "NRJDA.pdf"); Assert.AreEqual(forCheck.Files[0].LinkType, 9); Assert.AreEqual(forCheck.Files[0].ParentTypeId, 4); Assert.AreEqual(forCheck.Kits.Count, 1); }
public void TestQuery() { var enviroment = GetEnviroment(); enviroment.NewLoader.FirstLoad(); var aircraftCore = new AircraftsCore(enviroment.Loader, enviroment.NewKeeper, enviroment.NewLoader); aircraftCore.LoadAllAircrafts(); var componentCore = new ComponentCore(enviroment, enviroment.Loader, enviroment.NewLoader, enviroment.NewKeeper, aircraftCore, null); var nrjDA = new NonRoutineJobDataAccess(enviroment.Loader, enviroment.Keeper); var kitsCore = new KitsCore(enviroment, enviroment.Loader, enviroment.NewKeeper, componentCore, nrjDA); kitsCore.GetAllAircraftKits(2316, 326); }
/* public static Presenters Presenters * { * get { return presenters; } * }*/ static Program() { var exePath = Path.GetDirectoryName(Application.ExecutablePath); var path = Path.Combine(exePath, "AppSettings.json"); var json = File.ReadAllText(path); GlobalObjects.Config = JsonConvert.DeserializeObject <JObject>(json); AuditContext auditContext = null; try { auditContext = new AuditContext((string)GlobalObjects.Config["ConnectionStrings"]["Audit"]); } catch {} GlobalObjects.AuditRepository = new AuditRepository(auditContext); GlobalObjects.AuditContext = auditContext; var environment = DbTypes.CasEnvironment = new CasEnvironment(); environment.AuditRepository = GlobalObjects.AuditRepository; environment.ApiProvider = new ApiProvider((string)GlobalObjects.Config["ConnectionStrings"]["ScatTest"]); var nonRoutineJobDataAccess = new NonRoutineJobDataAccess(environment.Loader, environment.Keeper); var itemsRelationsDataAccess = new ItemsRelationsDataAccess(environment); var filesDataAccess = new FilesDataAccess(environment.NewLoader); var workPackageRecordsDataAccess = new WorkPackageRecordsDataAccess(environment); var storeService = new StoreCore(environment); var aircraftService = new AircraftsCore(environment.Loader, environment.NewKeeper, environment.NewLoader); var compontntService = new ComponentCore(environment, environment.Loader, environment.NewLoader, environment.NewKeeper, aircraftService, itemsRelationsDataAccess); var averageUtilizationService = new AverageUtilizationCore(aircraftService, storeService, compontntService); var directiveService = new DirectiveCore(environment.NewKeeper, environment.NewLoader, environment.Keeper, environment.Loader, itemsRelationsDataAccess); var aircraftFlightService = new AircraftFlightCore(environment, environment.Loader, environment.NewLoader, directiveService, environment.Manipulator, compontntService, environment.NewKeeper, aircraftService); var flightTrackService = new FlightTrackCore(environment.NewLoader, environment.Loader, environment); var calculator = new Calculator(environment, compontntService, aircraftFlightService, aircraftService); var mtopCalculator = new MTOPCalculator(calculator, aircraftService, averageUtilizationService); var planOpsCalculator = new PlanOpsCalculator(environment.NewLoader, environment.NewKeeper, aircraftService, flightTrackService); var performanceCalculator = new PerformanceCalculator(calculator, averageUtilizationService, mtopCalculator); var packageService = new PackagesCore(environment, environment.NewKeeper, environment.Loader, aircraftService, compontntService); var purchaseService = new PurchaseCore(environment, environment.NewLoader, environment.Loader, packageService, environment.NewKeeper, performanceCalculator); var calcStockService = new StockCalculator(environment, environment.NewLoader, compontntService); var documentService = new DocumentCore(environment, environment.NewLoader, environment.Loader, aircraftService, environment.NewKeeper, compontntService); var maintenanceService = new MaintenanceCore(environment, environment.NewLoader, environment.NewKeeper, itemsRelationsDataAccess, aircraftService); var maintenanceCheckCalculator = new MaintenanceCheckCalculator(calculator, averageUtilizationService, performanceCalculator); var analystService = new AnalystCore(compontntService, maintenanceService, directiveService, maintenanceCheckCalculator, performanceCalculator); var discrepanciesService = new DiscrepanciesCore(environment.Loader, environment.NewLoader, directiveService, aircraftFlightService); var kitsService = new KitsCore(environment, environment.Loader, environment.NewKeeper, compontntService, nonRoutineJobDataAccess); var smsService = new SMSCore(environment.Manipulator); var personelService = new PersonnelCore(environment); var transferRecordCore = new TransferRecordCore(environment.NewLoader, environment.NewKeeper, compontntService, aircraftService, calculator, storeService, filesDataAccess); var bindedItemsService = new BindedItemsCore(compontntService, directiveService, maintenanceService); var performanceService = new PerformanceCore(environment.NewKeeper, environment.Keeper, calculator, bindedItemsService); var workPackageService = new WorkPackageCore(environment, environment.NewLoader, maintenanceService, environment.NewKeeper, calculator, compontntService, aircraftService, nonRoutineJobDataAccess, directiveService, filesDataAccess, performanceCalculator, performanceService, bindedItemsService, workPackageRecordsDataAccess, mtopCalculator, averageUtilizationService); var nonRoutineJobService = new NonRoutineJobCore(environment, workPackageService, nonRoutineJobDataAccess, environment.NewLoader); var auditService = new AuditCore(environment, environment.Loader, environment.NewLoader, environment.NewKeeper, calculator, performanceCalculator, performanceService); DbTypes.AircraftsCore = aircraftService; GlobalObjects.CasEnvironment = environment; GlobalObjects.PackageCore = packageService; GlobalObjects.PurchaseCore = purchaseService; GlobalObjects.ComponentCore = compontntService; GlobalObjects.AnalystCore = analystService; GlobalObjects.StockCalculator = calcStockService; GlobalObjects.DocumentCore = documentService; GlobalObjects.AuditCore = auditService; GlobalObjects.MaintenanceCore = maintenanceService; GlobalObjects.WorkPackageCore = workPackageService; GlobalObjects.NonRoutineJobCore = nonRoutineJobService; GlobalObjects.DirectiveCore = directiveService; GlobalObjects.AircraftFlightsCore = aircraftFlightService; GlobalObjects.DiscrepanciesCore = discrepanciesService; GlobalObjects.KitsCore = kitsService; GlobalObjects.SmsCore = smsService; GlobalObjects.PersonnelCore = personelService; GlobalObjects.TransferRecordCore = transferRecordCore; GlobalObjects.AircraftsCore = aircraftService; GlobalObjects.ItemsRelationsDataAccess = itemsRelationsDataAccess; GlobalObjects.StoreCore = storeService; GlobalObjects.BindedItemsCore = bindedItemsService; GlobalObjects.AverageUtilizationCore = averageUtilizationService; GlobalObjects.MaintenanceCheckCalculator = maintenanceCheckCalculator; GlobalObjects.MTOPCalculator = mtopCalculator; GlobalObjects.PerformanceCalculator = performanceCalculator; GlobalObjects.PlanOpsCalculator = planOpsCalculator; GlobalObjects.PerformanceCore = performanceService; GlobalObjects.FlightTrackCore = flightTrackService; environment.SetAircraftCore(aircraftService); environment.Calculator = calculator; environment.Manipulator.PurchaseService = GlobalObjects.PurchaseCore; environment.Manipulator.MaintenanceCore = GlobalObjects.MaintenanceCore; environment.Manipulator.WorkPackageCore = GlobalObjects.WorkPackageCore; environment.Manipulator.AircraftFlightCore = GlobalObjects.AircraftFlightsCore; environment.Manipulator.ComponentCore = GlobalObjects.ComponentCore; environment.Manipulator.AircraftsCore = GlobalObjects.AircraftsCore; environment.Manipulator.BindedItemCore = GlobalObjects.BindedItemsCore; InitLoadingVariants(); InitializePresenters(); }