public void call_generic_method_passing_and_returning_reftype_on_static_generic_class()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var referenceTypeParameter = new DefaultClass();

            //Act
            StaticGenericClass <int> .GenericMethodThree <DefaultClass>(referenceTypeParameter);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethodThree", "!!0", null, new object[] { referenceTypeParameter }, referenceTypeParameter, null, "NewRelic.Agent.Tests.ProfiledMethods.StaticGenericClass`1");
        }
        public void call_method_on_inner_default_class_pass_and_return_referencetype_as_generic_type()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var referenceTypeParameter = new DefaultClass();
            var innerClass             = new OuterGenericClass <DefaultClass> .InnerDefaultClass();

            //Act
            var returnedValue = innerClass.InnerClassMethodReturnsIt(referenceTypeParameter);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "InnerClassMethodReturnsIt", "!0", innerClass, new object[] { referenceTypeParameter }, referenceTypeParameter, null, "NewRelic.Agent.Tests.ProfiledMethods.OuterGenericClass`1+InnerDefaultClass");
        }
        public void call_generic_method_on_inner_default_class_of_generic_class_reference_type()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var referenceTypeParameter = new DefaultClass();
            var innerClass             = new OuterGenericClass <int> .InnerDefaultClass();

            //Act
            innerClass.InnerGenericMethod <DefaultClass>(referenceTypeParameter);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "InnerGenericMethod", "!!0", innerClass, new object[] { referenceTypeParameter }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.OuterGenericClass`1+InnerDefaultClass");
        }
        public void call_generic_method_passing_both_class_and_method_generic_params_3()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var referenceTypeParameter = new DefaultClass();
            var genClass = new GenericClass <DefaultClass>(new DefaultClass());

            //Act
            genClass.GenericMethodTwo <DefaultClass>(null, referenceTypeParameter);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethodTwo", "!!0,!0", genClass, new object[] { null, referenceTypeParameter }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClass`1");
        }
        public void call_generic_method_passing_reftype_on_generic_class_with_different_type()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var referenceTypeParameter = new DefaultClass();
            var genClass = new GenericClass <int>(50);

            //Act
            genClass.GenericMethod <DefaultClass>(referenceTypeParameter);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethod", "!!0", genClass, new object[] { referenceTypeParameter }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClass`1");
        }
        public void call_generic_method_with_type_constraint_on_class_generic_type()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var derivedClass           = new DerivedClass();
            var defaultClass           = new DefaultClass();
            var genClass = new GenericClassComplexConstraints <DerivedClass, DefaultClass, BaseClass>();

            //Act
            genClass.GenericMethodOne <DefaultClass>(defaultClass, derivedClass);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethodOne", "!!0,NewRelic.Agent.Tests.ProfiledMethods.BaseClass", genClass, new object[] { defaultClass, derivedClass }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClassComplexConstraints`3");
        }
        public void call_method_passing_on_generic_class_with_type_constraint_relationship_between_gentypes()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var derivedClass           = new DerivedClass();
            var defaultClass           = new DefaultClass();
            var genClass = new GenericClassComplexConstraints <DerivedClass, DefaultClass, BaseClass>();

            //Act
            genClass.DefaultMethod(derivedClass, defaultClass);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "DefaultMethod", "!0,!1", genClass, new object[] { derivedClass, defaultClass }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClassComplexConstraints`3");
        }
        public void call_method_on_generic_class_with_multiple_type_constraints()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var intParameter           = 37;
            var defaultClass           = new DefaultClass();
            var genClass = new GenericClassMultipleTypeConstraints <int, DefaultClass>();

            //Act
            genClass.DefaultMethod(intParameter, defaultClass);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "DefaultMethod", "!0,!1", genClass, new object[] { intParameter, defaultClass }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClassMultipleTypeConstraints`2");
        }
        public void call_generic_method_passing_gentype_in_generic_class()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var referenceTypeParameter = new DefaultClass();
            var genClass2 = new GenericClass2 <string>("Rain");
            var genClass  = new GenericClass <GenericClass2 <string> >();

            //Act
            genClass.GenericMethodTwo <DefaultClass>(referenceTypeParameter, genClass2);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethodTwo", "!!0,!0", genClass, new object[] { referenceTypeParameter, genClass2 }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClass`1");
        }
Exemplo n.º 10
0
        public void call_generic_method_with_multiple_type_constraints_on_class_generic_types()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();
            var baseClass    = new BaseClass();
            var derivedClass = new DerivedClass();
            var defaultClass = new DefaultClass();
            var genClass     = new GenericClassComplexConstraints <DerivedClass, DefaultClass, BaseClass>();

            //Act
            var returned = genClass.GenericMethodTwo <BaseClass, DefaultClass>(derivedClass, defaultClass, baseClass);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethodTwo", "!!0,!!1,!2", genClass, new object[] { derivedClass, defaultClass, baseClass }, returned, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClassComplexConstraints`3");
        }
Exemplo n.º 11
0
        public void call_generic_method_with_var_args_on_generic_class()
        {
            //Arrange
            var getTracerParameters    = DefaultGetTracerImplementation();
            var finishTracerParameters = DefaultFinishTracerImplementation();

            var referenceTypeParameter = new DefaultClass();
            var refTypeParam2          = new DefaultClass();
            var refTypeParam3          = new DefaultClass();
            var genClass = new GenericClass <string>("MVPTom");

            //Act
            genClass.GenericMethodFour <DefaultClass>(referenceTypeParameter, refTypeParam2, refTypeParam3);

            //Assert
            ValidateTracers(getTracerParameters, finishTracerParameters, "GenericMethodFour", "!!0,!!0[]", genClass, new object[] { referenceTypeParameter, new object[] { refTypeParam2, refTypeParam3 } }, null, null, "NewRelic.Agent.Tests.ProfiledMethods.GenericClass`1");
        }