public void Should_initialize_facility_when_added_to_the_container() { var container = new CompactContainer(); var facility = new TestFacility(); container.AddFacility(facility); facility.Initialized.Should().Be.True(); }
/// <summary> /// Adds an array Object Definition to the Registry /// </summary> /// <param name="cont"></param> public void AddDefinitions(CompactContainer cont) { if (cont != null) { foreach (Context var in cont.Contexts) { AddDefinitions(var); } } }
public void Can_supply_dependency_through_configuration() { var container = new CompactContainer(); container.Configuration["CompactContainer.Tests.TestComponent.abc"] = 5; container.Register(Component.For<TestComponent>()); var x = container.Resolve<TestComponent>(); x.Abc.Should().Be.EqualTo(5); }
public void Component_registered_event_parameter_should_match_recently_registered_component_info() { var container = new CompactContainer(); Type registeredType = null; container.ComponentRegistered += x => { registeredType = x.Classtype; }; container.Register(Component.For<ComponentA>()); registeredType.Should().Be.EqualTo(typeof (ComponentA)); }
public void Should_fire_component_registered_event_when_a_new_component_is_registered() { var container = new CompactContainer(); var eventRisen = false; container.ComponentRegistered += x => { eventRisen = true; }; container.Register(Component.For<ComponentA>()); eventRisen.Should().Be.True(); }
public void Should_terminate_added_facilities_when_disposing_the_container() { var facility = new TestFacility(); using( var container = new CompactContainer()) { container.AddFacility(facility); } facility.Terminated.Should().Be.True(); }
public void Should_terminate_added_facilities_when_disposing_the_container() { var facility = new TestFacility(); using (var container = new CompactContainer()) { container.AddFacility(facility); } facility.Terminated.Should().Be.True(); }
public void Init() { container = new CompactContainer(); container.Register( Component.For <IComponentA>().ImplementedBy <ComponentA>(), Component.For <IComponentB>().ImplementedBy <ComponentB>(), Component.For <IComponentC>().ImplementedBy <ComponentC>(), Component.For <ComponentE>() ); }
public void Init() { container = new CompactContainer(); container.Register( Component.For<IComponentA>().ImplementedBy<ComponentA>(), Component.For<IComponentB>().ImplementedBy<ComponentB>(), Component.For<IComponentC>().ImplementedBy<ComponentC>(), Component.For<ComponentE>() ); }
public void Can_supply_dependency_through_configuration() { var container = new CompactContainer(); container.Configuration["CompactContainer.Tests.TestComponent.abc"] = 5; container.Register(Component.For <TestComponent>()); var x = container.Resolve <TestComponent>(); x.Abc.Should().Be.EqualTo(5); }
public void ComponentCreated_component_info_parameter_should_match_recently_added_component_info() { var container = new CompactContainer(); container.Register(Component.For<ComponentA>()); Type componentType = null; container.ComponentCreated += (ci, i) => componentType = ci.Classtype; container.Resolve<ComponentA>(); componentType.Should().Be.EqualTo(typeof (ComponentA)); }
public void Should_fire_component_created_event_when_a_new_component_instaces_is_created() { var container = new CompactContainer(); container.Register(Component.For<ComponentA>()); var eventRisen = false; container.ComponentCreated += (ci, i) => { eventRisen = true; }; container.Resolve<ComponentA>(); eventRisen.Should().Be.True(); }
public void ComponentCreated_instace_parameter_should_be_equal_to_newly_created_instace() { var container = new CompactContainer(); container.Register(Component.For<ComponentA>()); object instance = null; container.ComponentCreated += (ci, i) => instance = i; var componentA = container.Resolve<ComponentA>(); instance.Should().Be.EqualTo(componentA); }
public void Component_registered_event_parameter_should_match_recently_registered_component_info() { var container = new CompactContainer(); Type registeredType = null; container.ComponentRegistered += x => { registeredType = x.Classtype; }; container.Register(Component.For <ComponentA>()); registeredType.Should().Be.EqualTo(typeof(ComponentA)); }
public void Should_fire_component_registered_event_when_a_new_component_is_registered() { var container = new CompactContainer(); var eventRisen = false; container.ComponentRegistered += x => { eventRisen = true; }; container.Register(Component.For <ComponentA>()); eventRisen.Should().Be.True(); }
public void Can_select_implementation_according_to_registered_component_selector() { var container = new CompactContainer(); container.Register(AllTypes.FromAssembly(Assembly.GetExecutingAssembly()) .BasedOn<IService>() .BasedOn<IComponentSelector>() ); container.RegisterComponentSelector(new ServiceSelector()); var service = container.Resolve<IService>(); service.Should().Be.OfType<ComplexService>(); }
public void ComponentCreated_component_info_parameter_should_match_recently_added_component_info() { var container = new CompactContainer(); container.Register(Component.For <ComponentA>()); Type componentType = null; container.ComponentCreated += (ci, i) => componentType = ci.Classtype; container.Resolve <ComponentA>(); componentType.Should().Be.EqualTo(typeof(ComponentA)); }
public void ComponentCreated_instace_parameter_should_be_equal_to_newly_created_instace() { var container = new CompactContainer(); container.Register(Component.For <ComponentA>()); object instance = null; container.ComponentCreated += (ci, i) => instance = i; var componentA = container.Resolve <ComponentA>(); instance.Should().Be.EqualTo(componentA); }
public void Can_select_implementation_according_to_registered_component_selector() { var container = new CompactContainer(); container.Register(AllTypes.FromAssembly(Assembly.GetExecutingAssembly()) .BasedOn <IService>() .BasedOn <IComponentSelector>() ); container.RegisterComponentSelector(new ServiceSelector()); var service = container.Resolve <IService>(); service.Should().Be.OfType <ComplexService>(); }
public void Should_fire_component_created_event_when_a_new_component_instaces_is_created() { var container = new CompactContainer(); container.Register(Component.For <ComponentA>()); var eventRisen = false; container.ComponentCreated += (ci, i) => { eventRisen = true; }; container.Resolve <ComponentA>(); eventRisen.Should().Be.True(); }
private void Initialize() { this.WindowStyle = System.Windows.WindowStyle.None; this.ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip; //this.Topmost = true; // This removes the resize border with CanResizeWithGrip this.AllowsTransparency = true; // Remove the resize grip Style gripStyle = new Style(typeof(ResizeGrip)); gripStyle.Setters.Add(new Setter(ResizeGrip.TemplateProperty, null)); Resources.Add(typeof(ResizeGrip), gripStyle); this.Loaded += WPFCompactForm_Loaded; container = new CompactContainer(); container.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; container.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; contentGrid = new Grid(); contentSplitter = new GridSplitter(); contentSplitter.ShowsPreview = true; contentSplitter.IsTabStop = false; contentContainer = new CompactContentContainer(this); contentContainer.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; contentContainer.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; contentContainer.Children.Add(contentGrid); originalTextBox = new CompactTextBox(); originalTextBox.Background = Brushes.White; originalTextBox.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; originalTextBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; translatedTextBox = new CompactTextBox(); translatedTextBox.TextBox.IsReadOnly = true; translatedTextBox.TextBox.IsReadOnlyCaretVisible = ShowTranslatedTextBoxCaret; translatedTextBox.Background = Brushes.White; translatedTextBox.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; translatedTextBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; Header = new CompactHeader(this); Header.BackColor = BorderColor; Header.Layout(); this.SnapsToDevicePixels = true; this.FocusVisualStyle = null; contentSplitter.FocusVisualStyle = null; // Maybe shouldn't need BorderSize here, should the border be able to collapse into the header? //MinHeight = MinWidth = header.HeaderSize + BorderSize; this.MinWidth = 150; this.MinHeight = 100; // Alternative method for borderless with resize functionality (buggy) /*this.BorderThickness = new Thickness(0); * WindowChrome windowChrome = new WindowChrome(); * windowChrome.GlassFrameThickness = new Thickness(5); * windowChrome.CornerRadius = new CornerRadius(0); * windowChrome.CaptionHeight = header.HeaderSize - 4; * WindowChrome.SetWindowChrome(this, windowChrome);*/ AddChild(container); CreateLayout(); }
public void Init() { container = new CompactContainer(); }
public void SetUp() { container = new CompactContainer(); }
public void AddDefinitions(CompactContainer cont) { _registry.AddDefinitions(cont); }
public CompactConstructor(CompactContainer container, string contextName) { _ContextName = contextName; _registry.AddDefinitions(container); }
public CompactConstructor(CompactContainer container) { _registry.AddDefinitions(container); }