Esempio n. 1
0
        /// <summary>
        /// Register a new aggregation function defined with annotations on a java class. </summary>
        /// <param name="func"> the function class </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void registerAggregationFunction(Class func, boolean overrideCurrentImplementation) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        public virtual void RegisterAggregationFunction(Type func, bool overrideCurrentImplementation)
        {
            foreach (CallableUserAggregationFunction function in _compiler.compileAggregationFunction(func))
            {
                Register(function, overrideCurrentImplementation);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInjectLogging() throws org.neo4j.internal.kernel.api.exceptions.KernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInjectLogging()
        {
            // Given
            Log log = spy(typeof(Log));

            _components.register(typeof(Log), ctx => log);
            CallableUserAggregationFunction function = _procedureCompiler.compileAggregationFunction(typeof(LoggingFunction))[0];

            // When
            UserAggregator aggregator = function.Create(new BasicContext());

            aggregator.Update(new object[] {});
            aggregator.Result();

            // Then
            verify(log).debug("1");
            verify(log).info("2");
            verify(log).warn("3");
            verify(log).error("4");
        }