private ComponentRegistry RegistryWithUnsafeAPI()
        {
            ComponentRegistry allComponents = new ComponentRegistry();

            allComponents.Register(typeof(UnsafeAPI), ctx => new UnsafeAPI());
            return(allComponents);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            ComponentRegistry safeComponents = new ComponentRegistry();
            ComponentRegistry allComponents  = new ComponentRegistry();

            safeComponents.Register(typeof(MyAwesomeAPI), ctx => new MyAwesomeAPI());
            allComponents.Register(typeof(MyAwesomeAPI), ctx => new MyAwesomeAPI());
            allComponents.Register(typeof(MyUnsafeAPI), ctx => new MyUnsafeAPI());

            _compiler = new ReflectiveProcedureCompiler(new TypeMappers(), safeComponents, allComponents, _log, ProcedureConfig.Default);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void syntheticsAllowed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SyntheticsAllowed()
        {
            // Given
            ComponentRegistry components = new ComponentRegistry();

            components.Register(typeof(int), ctx => 1337);
            FieldInjections injections = new FieldInjections(components);

            // When
            IList <FieldInjections.FieldSetter> setters = injections.Setters(typeof(Outer.ClassWithSyntheticField));

            // Then
            Outer.ClassWithSyntheticField syntheticField = (new Outer()).ClassWithSyntheticField();
            foreach (FieldInjections.FieldSetter setter in setters)
            {
                setter.Apply(null, syntheticField);
            }

            assertEquals(1337, syntheticField.InnerField);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void inheritanceIsAllowed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void InheritanceIsAllowed()
        {
            // Given
            ComponentRegistry components = new ComponentRegistry();

            components.Register(typeof(int), ctx => 1337);
            FieldInjections injections = new FieldInjections(components);

            // When
            IList <FieldInjections.FieldSetter> setters = injections.Setters(typeof(ChildProcedure));

            // Then
            ChildProcedure childProcedure = new ChildProcedure();

            foreach (FieldInjections.FieldSetter setter in setters)
            {
                setter.Apply(null, childProcedure);
            }

            assertEquals(1337, childProcedure.ChildField);
            assertEquals(1337, childProcedure.ParentField);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _components        = new ComponentRegistry();
            _procedureCompiler = new ReflectiveProcedureCompiler(new TypeMappers(), _components, _components, NullLog.Instance, ProcedureConfig.Default);
        }
Beispiel #6
0
 internal FieldInjections(ComponentRegistry components)
 {
     this._components = components;
 }