public void MedicamentPriceHistoryDeleteRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <MedicamentPriceHistory> >(); var firstMedicament = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Medicament> >().FindAll().FirstOrDefault(); if (firstMedicament == null) { throw new AssertFailedException(); } manager.Add( new MedicamentPriceHistory() { Medicament = firstMedicament, ModifiedDate = DateTime.Now, Price = new Random().Next(100500) }); manager.SaveChanges(); var currentCountRecords = manager.FindAll().Count(); var removeEntity = manager.FindAll().FirstOrDefault(); if (removeEntity == null) { throw new AssertFailedException(); } manager.Remove(removeEntity); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords - 1, newCountRecords); }
public void OrderDetailsesDeleteRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Storage> >(); var firstMedicament = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Medicament> >().FindAll().FirstOrDefault(); var firstPharmacy = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Pharmacy> >().FindAll().FirstOrDefault(); if (firstPharmacy == null || firstMedicament == null) { throw new AssertFailedException(); } manager.Add( new Storage() { Count = 10, MedicamentId = firstMedicament.Id, PharmacyId = firstPharmacy.Id, }); manager.SaveChanges(); var currentCountRecords = manager.FindAll().Count(); var removeEntity = manager.FindAll().FirstOrDefault(); if (removeEntity == null) { throw new AssertFailedException(); } manager.Remove(removeEntity); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords - 1, newCountRecords); }
public void MedicamentPriceHistoryEditRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <MedicamentPriceHistory> >(); var firstRecord = manager.FindAll().FirstOrDefault(); if (firstRecord == null) { throw new AssertFailedException(); } var id = firstRecord.Id; var oldPrice = firstRecord.Price; var newPrice = new Random().Next(100500); firstRecord.Price = newPrice; manager.SaveChanges(); var changedRecord = manager.Find(m => m.Id == id && m.Price == newPrice).FirstOrDefault(); Assert.IsNotNull(changedRecord); changedRecord.Price = oldPrice; manager.SaveChanges(); changedRecord = manager.Find(m => m.Id == id && m.Price == newPrice).FirstOrDefault(); Assert.IsNull(changedRecord); }
protected override void OnEnable() { base.OnEnable(); m_parentDockPanel = GetComponentInParent <DockPanel>(); SetComponentsActive(true); IRuntimeSceneComponent scene = IOCContainer.Resolve <IRuntimeSceneComponent>(); scene.CameraPosition = new Vector3(0.5f, 0.5f, -1) * ManualUVRenderer.Scale; scene.Pivot = new Vector3(0.5f, 0.5f, 0) * ManualUVRenderer.Scale; scene.IsSelectionVisible = false; scene.IsOrthographic = true; scene.CanRotate = false; scene.CanFreeMove = false; scene.CanSelect = false; scene.CanSelectAll = false; // scene.ChangeOrthographicSizeOnly = true; if (scene.Selection != m_uvEditor.PivotPointSelection) { scene.Selection = m_uvEditor.PivotPointSelection; m_uvEditor.PivotPointSelection.activeObject = null; } IRTEAppearance appearance = IOC.Resolve <IRTEAppearance>(); Camera.backgroundColor = appearance.Colors.Secondary; Camera.cullingMask = 0; Camera.clearFlags = CameraClearFlags.SolidColor; EnableRaycasts(); Editor.StartCoroutine(CoSetAlpha()); }
public void StorageAddNewRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Storage> >(); var currentCountRecords = manager.FindAll().Count(); var firstMedicament = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Medicament> >().FindAll().FirstOrDefault(); var firstPharmacy = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Pharmacy> >().FindAll().FirstOrDefault(); if (firstPharmacy == null || firstMedicament == null) { throw new AssertFailedException(); } var existingEntity = manager .FindAll() .FirstOrDefault(m => m.MedicamentId == firstMedicament.Id && m.PharmacyId == firstPharmacy.Id); if (existingEntity != null) { return; } manager.Add( new Storage() { Count = 10, MedicamentId = firstMedicament.Id, PharmacyId = firstPharmacy.Id, }); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords + 1, newCountRecords); }
public void OrderDeleteRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Order> >(); var firstPharmacy = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Pharmacy> >().FindAll().FirstOrDefault(); manager.Add(new Order() { OperationDate = DateTime.Now, OperationType = OperationType.Purchase, Pharmacy = firstPharmacy }); manager.SaveChanges(); var currentCountRecords = manager.FindAll().Count(); var removeEntity = manager.FindAll().FirstOrDefault(); if (removeEntity == null) { throw new AssertFailedException(); } manager.Remove(removeEntity); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords - 1, newCountRecords); }
protected virtual void Start() { if (transform.parent != null) { RuntimeWindow parent = transform.parent.GetComponentInParent <RuntimeWindow>(); if (parent != null) { Depth = parent.Depth + 1; } } //m_texturePreview.transform.position = new Vector3(ManualUVRenderer.Scale, ManualUVRenderer.Scale, 2) * 0.5f; m_texturePreview.transform.rotation = Quaternion.Euler(90, 180, 0); m_texturePreview.transform.localScale = Vector3.one * 10; m_texturePreview.sharedMaterial.mainTextureScale = Vector2.one * 10; m_graphicsLayer = IOCContainer.Resolve <IRTEGraphicsLayer>(); m_graphicsLayer.Camera.RenderersCache.Add(m_texturePreview); m_materialEditor = IOC.Resolve <IMaterialEditor>(); m_materialEditor.MaterialsApplied += OnMaterialApplied; m_paletteManager = IOC.Resolve <IMaterialPaletteManager>(); m_paletteManager.PaletteChanged += OnPaletteChanged; m_paletteManager.MaterialAdded += OnMaterialsChanged; m_paletteManager.MaterialCreated += OnMaterialsChanged; m_paletteManager.MaterialRemoved += OnMaterialsChanged; }
public void PharmacyEditRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Medicament> >(); manager.Add(new Medicament() { Description = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(), Price = (decimal)100.25, SerialNumber = Guid.NewGuid().ToString() }); manager.SaveChanges(); var firstRecord = manager.FindAll().FirstOrDefault(); if (firstRecord == null) { throw new AssertFailedException(); } var oldName = firstRecord.Name; firstRecord.Name = "TestName"; manager.SaveChanges(); var changedRecord = manager.Find(m => m.Name == "TestName").FirstOrDefault(); Assert.IsNotNull(changedRecord); changedRecord.Name = oldName; manager.SaveChanges(); changedRecord = manager.Find(m => m.Name == "TestName").FirstOrDefault(); Assert.IsNull(changedRecord); }
public void MedicamentDeleteRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Medicament> >(); manager.Add(new Medicament() { Description = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(), Price = (decimal)100.25, SerialNumber = Guid.NewGuid().ToString() }); manager.SaveChanges(); var currentCountRecords = manager.FindAll().Count(); var removeEntity = manager.FindAll().FirstOrDefault(); if (removeEntity == null) { throw new AssertFailedException(); } manager.Remove(removeEntity); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords - 1, newCountRecords); }
public void OrderDetailsesAddNewRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <OrderDetails> >(); var currentCountRecords = manager.FindAll().Count(); var firstMedicament = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Medicament> >().FindAll().FirstOrDefault(); var firstOrder = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Order> >().FindAll().FirstOrDefault(); if (firstOrder == null || firstMedicament == null) { throw new AssertFailedException(); } manager.Add( new OrderDetails() { Count = 10, MedicamentId = firstMedicament.Id, OrderId = firstOrder.Id, UnitPrice = (decimal)2015.02 }); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords + 1, newCountRecords); }
public void TestNoDefaultValidationAvailable() { // Need to move to :InterceptAttribute IOCContainer.Configure(); var provider = IOCContainer.Get <Orchestration>(); provider.UpdateEmployee(null); }
static void Main(string[] args) { var container = new IOCContainer(); container.Register <ISomeService>(() => new SomeService()); // ... var service = container.Resolve <ISomeService>(); }
public static InMemoryContext SeedDatabaseFourEmployees() { InMemoryContext Context = (InMemoryContext)IOCContainer.GetReqDBContext("memory"); Context.Employees.AddRange(CreateFourBooks()); Context.SaveChanges(); return(Context); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); IOCContainer.Build(); }
public QuartzStartup(IOCContainer IocContainer, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <QuartzStartup>(); iocJobfactory = new IOCJobFactory(IocContainer); var schedulerFactory = new StdSchedulerFactory(); _scheduler = schedulerFactory.GetScheduler().Result; _scheduler.JobFactory = iocJobfactory; }
public LaboratoryWorkService(UnitOfWork unitOfWork, UserService userService, ICharacterEncoder encoder, IPlagiarismDetector plagiarismDetector, IMapper mapper) { _unitOfWork = unitOfWork; _userService = userService; _streamFetcher = IOCContainer.Resolve <IStreamFetcher>(); _encoder = encoder; _plagiarismDetector = plagiarismDetector; _mapper = mapper; }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Shuts down this object and frees any resources it is using. </summary> /// /// <returns> True if it succeeds, false if it fails. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public virtual bool Shutdown() { using (var scope = IOCContainer?.BeginLifetimeScope()) { var logger = scope?.Resolve <MSBaseLogger>(); logger?.LogInformation(Name + " Microservice Shutting Down"); Console.WriteLine(Name + " Microservice Shutting Down", Color.Yellow); } return(true); }
protected void Page_Load(object sender, EventArgs e) { userBusiness = IOCContainer.Resolve <IUserBusiness>(); if (!Page.IsPostBack) { UserList.DataSource = userBusiness.Get(); UserList.DataBind(); } }
public IOCContainerBuilder Add <t, u>() where u : t { if (containers == null) { containers = new IOCContainer(); } containers.dic.Add(typeof(t), typeof(u)); return(this); }
public void TestDefaultOrchastrationFail() { var sampleRq = new EmployeeBuilder().JohnDoe().DateInFuture().BuildAddRequest(); // Need to move to :InterceptAttribute IOCContainer.Configure(); var provider = IOCContainer.Get <Orchestration>(); provider.AddEmployee(sampleRq); }
protected override void OnStartup(StartupEventArgs e) { IOCContainer.InitAutofac(); VM_WindowMain main = new VM_WindowMain(); main.Show(); base.OnStartup(e); }
protected virtual void OnAssetItemLoaded(Error error, Object[] obj) { if (obj[0] is GameObject) { IScenePivot scenePivot = IOCContainer.Resolve <IScenePivot>(); Vector3 up = Vector3.up; if (Mathf.Abs(Vector3.Dot(Camera.transform.up, Vector3.up)) > Mathf.Cos(Mathf.Deg2Rad)) { up = Vector3.Cross(Camera.transform.right, Vector3.up); } else { up = Vector3.up; } m_dragPlane = GetDragPlane(scenePivot, up); GameObject prefab = (GameObject)obj[0]; bool wasPrefabEnabled = prefab.activeSelf; prefab.SetActive(false); Vector3 point; if (GetPointOnDragPlane(out point)) { m_prefabInstance = InstantiatePrefab(prefab, point, Quaternion.identity); } else { m_prefabInstance = InstantiatePrefab(prefab, Vector3.zero, Quaternion.identity); } Debug.Log(m_prefabInstance.GetComponentsInChildren <MeshFilter>().Length); m_prefabInstanceTransforms = new HashSet <Transform>(m_prefabInstance.GetComponentsInChildren <Transform>(true)); prefab.SetActive(wasPrefabEnabled); Transform[] transforms = m_prefabInstance.GetComponentsInChildren <Transform>(); foreach (Transform transform in transforms) { ExposeToEditor exposeToEditor = transform.GetComponent <ExposeToEditor>(); if (exposeToEditor == null) { exposeToEditor = transform.gameObject.AddComponent <ExposeToEditor>(); } } { ExposeToEditor exposeToEditor = m_prefabInstance.GetComponent <ExposeToEditor>(); exposeToEditor.SetName(obj[0].name); } OnActivatePrefabInstance(m_prefabInstance); } }
protected override void OnPointerEnterOverride(PointerEventData eventData) { base.OnPointerEnterOverride(eventData); //Box Selection disappearing fix IRuntimeSceneComponent scene = IOCContainer.Resolve <IRuntimeSceneComponent>(); Canvas canvas = scene.BoxSelection.GetComponentInParent <Canvas>(); canvas.enabled = false; canvas.enabled = true; }
public void TestValidationSuccessfull() { var sampleRq = new EmployeeBuilder().JohnDoe().BuildAddRequest(); // Need to move to :InterceptAttribute IOCContainer.Configure(); var provider = IOCContainer.Get <Orchestration>(); var outcome = provider.AddEmployee(sampleRq); Assert.IsTrue(outcome); }
public override void DragEnter(object[] dragObjects, PointerEventData eventData) { base.DragEnter(dragObjects, eventData); if (Editor.DragDrop.DragObjects[0] is AssetItem) { AssetItem assetItem = (AssetItem)Editor.DragDrop.DragObjects[0]; if (m_project.ToType(assetItem) == typeof(GameObject)) { Editor.DragDrop.SetCursor(KnownCursor.DropAllowed); Editor.IsBusy = true; m_project.Load(assetItem, (error, obj) => { Editor.IsBusy = false; if (IsPointerOver) { if (obj is GameObject) { IScenePivot scenePivot = IOCContainer.Resolve <IScenePivot>(); Vector3 up = Vector3.up; if (Mathf.Abs(Vector3.Dot(Camera.transform.up, Vector3.up)) > Mathf.Cos(Mathf.Deg2Rad)) { up = Vector3.Cross(Camera.transform.right, Vector3.up); } else { up = Vector3.up; } m_dragPlane = new Plane(up, scenePivot.SecondaryPivot.position); GameObject prefab = (GameObject)obj; bool wasPrefabEnabled = prefab.activeSelf; prefab.SetActive(false); m_prefabInstance = Instantiate(prefab, Vector3.zero, Quaternion.identity); prefab.SetActive(wasPrefabEnabled); ExposeToEditor exposeToEditor = m_prefabInstance.GetComponent <ExposeToEditor>(); if (exposeToEditor == null) { exposeToEditor = m_prefabInstance.AddComponent <ExposeToEditor>(); } exposeToEditor.SetName(obj.name); m_prefabInstance.SetActive(true); } } }); } } }
static void Main() { MaterialSkinManager .Instance .ColorScheme = new ColorScheme( Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); new Bootstrapper(IOCContainer.GetContainer()) .Start(); }
static void Main(string[] args) { IOCContainer.Setup(); using (var myLifetime = IOCContainer.Container.BeginLifetimeScope()) { var myRootClass = myLifetime.Resolve <IMyRootClass>(); myRootClass.Increment(); Console.WriteLine(myRootClass.CountExceeded()); Console.ReadKey(); } }
public void PharmacyAddNewRecordTest() { var manager = IOCContainer.GetInstance().GetUnityContainer().Resolve <IManager <Pharmacy> >(); var currentCountRecords = manager.FindAll().Count(); manager.Add(new Pharmacy() { Address = Guid.NewGuid().ToString(), Number = Guid.NewGuid().ToString(), OpenDate = DateTime.Now, PhoneNumber = Guid.NewGuid().ToString() }); manager.SaveChanges(); var newCountRecords = manager.FindAll().Count(); Assert.AreEqual(currentCountRecords + 1, newCountRecords); }
private void CreateDragPlane() { IScenePivot scenePivot = IOCContainer.Resolve <IScenePivot>(); Vector3 up = Vector3.up; if (Mathf.Abs(Vector3.Dot(Camera.transform.up, Vector3.up)) > Mathf.Cos(Mathf.Deg2Rad)) { up = Vector3.Cross(Camera.transform.right, Vector3.up); } else { up = Vector3.up; } m_dragPlane = GetDragPlane(scenePivot, up); }
public VM_WindowMain() { _logservice = IOCContainer.GetFromFac <ILogService>(); PopupTable = new Hashtable(); CharacteristicBookList = new Popup <bool>(); PopularWriterList = new Popup <bool>(); DetailData = new DataGrid <DetailData>(); PopupTable.Add("CharacteristicBookList", CharacteristicBookList); PopupTable.Add("PopularWriterList", PopularWriterList); DetailData.SkipNumber = 1; DetailData.BindSource(LoadData); }