コード例 #1
0
        public void AUT_SocialEngineProxy_GetTransaction_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var webId      = CreateType <Guid>();
            var listId     = CreateType <Guid>();
            var itemId     = CreateType <int>();
            var contextWeb = CreateType <SPWeb>();
            var methodGetTransactionPrametersTypes = new Type[] { typeof(Guid), typeof(Guid), typeof(int), typeof(SPWeb) };

            object[]  parametersOfGetTransaction = { webId, listId, itemId, contextWeb };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetTransaction, methodGetTransactionPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _socialEngineProxyInstanceType, MethodGetTransaction, Fixture, methodGetTransactionPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <Guid?>(null, _socialEngineProxyInstanceType, MethodGetTransaction, parametersOfGetTransaction, methodGetTransactionPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfGetTransaction);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetTransaction.ShouldNotBeNull();
            parametersOfGetTransaction.Length.ShouldBe(4);
            methodGetTransactionPrametersTypes.Length.ShouldBe(4);
            Should.Throw <Exception>(currentAction);
        }
コード例 #2
0
        public void AUT_GanttUtilities_GanttImage_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var ganttImages = CreateType <Hashtable>();
            var imgNames    = CreateType <List <string> >();
            var methodGanttImagePrametersTypes = new Type[] { typeof(Hashtable), typeof(List <string>) };

            object[]  parametersOfGanttImage = { ganttImages, imgNames };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGanttImage, methodGanttImagePrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_ganttUtilitiesInstanceFixture, _ganttUtilitiesInstanceType, MethodGanttImage, Fixture, methodGanttImagePrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <LookupTypeInfo>(_ganttUtilitiesInstanceFixture, _ganttUtilitiesInstanceType, MethodGanttImage, parametersOfGanttImage, methodGanttImagePrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_ganttUtilitiesInstanceFixture, parametersOfGanttImage);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGanttImage.ShouldNotBeNull();
            parametersOfGanttImage.Length.ShouldBe(2);
            methodGanttImagePrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #3
0
        public void AUT_SPFieldTypeHelper_GetFieldType_Static_Method_Call_With_Call_Results_Should_Not_Be_Null_Test()
        {
            // Arrange
            var fieldType = CreateType <string>();
            var methodGetFieldTypePrametersTypes = new Type[] { typeof(string) };

            object[]  parametersOfGetFieldType = { fieldType };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetFieldType, methodGetFieldTypePrametersTypes, out exception);

            // Act
            var result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_sPFieldTypeHelperInstanceFixture, _sPFieldTypeHelperInstanceType, MethodGetFieldType, Fixture, methodGetFieldTypePrametersTypes);
            var result2 = ReflectionAnalyzer.GetResultOfStaticMethod <SPFieldType>(_sPFieldTypeHelperInstanceFixture, _sPFieldTypeHelperInstanceType, MethodGetFieldType, parametersOfGetFieldType, methodGetFieldTypePrametersTypes);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();
            result1.ShouldBe(result2);
            parametersOfGetFieldType.ShouldNotBeNull();
            parametersOfGetFieldType.Length.ShouldBe(1);
            methodGetFieldTypePrametersTypes.Length.ShouldBe(1);
            Should.NotThrow(() => ReflectionAnalyzer.GetResultOfStaticMethod <SPFieldType>(_sPFieldTypeHelperInstanceFixture, _sPFieldTypeHelperInstanceType, MethodGetFieldType, parametersOfGetFieldType, methodGetFieldTypePrametersTypes));
        }
コード例 #4
0
        public void AUT_JSONUtil_ConvertXmlToJson_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var xml    = CreateType <string>();
            var idlist = CreateType <string>();
            var methodConvertXmlToJsonPrametersTypes = new Type[] { typeof(string), typeof(string) };

            object[]  parametersOfConvertXmlToJson = { xml, idlist };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodConvertXmlToJson, methodConvertXmlToJsonPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_jSONUtilInstanceFixture, _jSONUtilInstanceType, MethodConvertXmlToJson, Fixture, methodConvertXmlToJsonPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_jSONUtilInstanceFixture, _jSONUtilInstanceType, MethodConvertXmlToJson, parametersOfConvertXmlToJson, methodConvertXmlToJsonPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_jSONUtilInstanceFixture, parametersOfConvertXmlToJson);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfConvertXmlToJson.ShouldNotBeNull();
            parametersOfConvertXmlToJson.Length.ShouldBe(2);
            methodConvertXmlToJsonPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #5
0
        public void AUT_ApplicationsLinkProvider_GetUrl_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var info = CreateType <string[]>();
            var methodGetUrlPrametersTypes = new Type[] { typeof(string[]) };

            object[]  parametersOfGetUrl = { info };
            Exception exception, exception1;
            var       methodInfo = GetMethodInfo(MethodGetUrl, methodGetUrlPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_applicationsLinkProviderInstanceFixture, _applicationsLinkProviderInstanceType, MethodGetUrl, Fixture, methodGetUrlPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_applicationsLinkProviderInstanceFixture, _applicationsLinkProviderInstanceType, MethodGetUrl, parametersOfGetUrl, methodGetUrlPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_applicationsLinkProviderInstanceFixture, parametersOfGetUrl);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetUrl.ShouldNotBeNull();
            parametersOfGetUrl.Length.ShouldBe(1);
            methodGetUrlPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #6
0
        public void AUT_DataCacheAPI_GetCachedData_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var Context = CreateType <HttpContext>();
            var sKey    = CreateType <string>();
            var methodGetCachedDataPrametersTypes = new Type[] { typeof(HttpContext), typeof(string) };

            object[]  parametersOfGetCachedData = { Context, sKey };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetCachedData, methodGetCachedDataPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_dataCacheAPIInstanceFixture, _dataCacheAPIInstanceType, MethodGetCachedData, Fixture, methodGetCachedDataPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <object>(_dataCacheAPIInstanceFixture, _dataCacheAPIInstanceType, MethodGetCachedData, parametersOfGetCachedData, methodGetCachedDataPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_dataCacheAPIInstanceFixture, parametersOfGetCachedData);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetCachedData.ShouldNotBeNull();
            parametersOfGetCachedData.Length.ShouldBe(2);
            methodGetCachedDataPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #7
0
        public void AUT_MyWorkSummaryListItems_GetMyWorkSummary_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var data = CreateType <string>();
            var methodGetMyWorkSummaryPrametersTypes = new Type[] { typeof(string) };

            object[]  parametersOfGetMyWorkSummary = { data };
            Exception exception, exception1;
            var       methodInfo = GetMethodInfo(MethodGetMyWorkSummary, methodGetMyWorkSummaryPrametersTypes, out exception);

            // Act
            var    result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_myWorkSummaryListItemsInstanceFixture, _myWorkSummaryListItemsInstanceType, MethodGetMyWorkSummary, Fixture, methodGetMyWorkSummaryPrametersTypes);
            var    result2 = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_myWorkSummaryListItemsInstanceFixture, _myWorkSummaryListItemsInstanceType, MethodGetMyWorkSummary, parametersOfGetMyWorkSummary, methodGetMyWorkSummaryPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_myWorkSummaryListItemsInstanceFixture, parametersOfGetMyWorkSummary);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetMyWorkSummary.ShouldNotBeNull();
            parametersOfGetMyWorkSummary.Length.ShouldBe(1);
            methodGetMyWorkSummaryPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #8
0
        public void AUT_PlannerCore_getFieldInfo_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            this.ValidateExecuteCondition(MethodgetFieldInfo);
            var web     = this.CreateType <SPWeb>();
            var planner = this.CreateType <string>();
            var methodgetFieldInfoPrametersTypes = new Type[] { typeof(SPWeb), typeof(string) };

            object[]  parametersOfgetFieldInfo = { web, planner };
            Exception exception;
            var       methodInfo = this.GetMethodInfo(MethodgetFieldInfo, methodgetFieldInfoPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_plannerCoreInstanceFixture, _plannerCoreInstanceType, MethodgetFieldInfo, Fixture, methodgetFieldInfoPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <SortedList>(_plannerCoreInstanceFixture, _plannerCoreInstanceType, MethodgetFieldInfo, parametersOfgetFieldInfo, methodgetFieldInfoPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_plannerCoreInstanceFixture, parametersOfgetFieldInfo);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfgetFieldInfo.ShouldNotBeNull();
            parametersOfgetFieldInfo.Length.ShouldBe(2);
            methodgetFieldInfoPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #9
0
        public void AUT_PlannerCore_getWorkPlannerFromTaskList_Static_Method_Call_With_Call_Results_Should_Not_Be_Null_Test()
        {
            // Arrange
            this.ValidateExecuteCondition(MethodgetWorkPlannerFromTaskList);
            var w    = this.CreateType <SPWeb>();
            var list = this.CreateType <string>();
            var methodgetWorkPlannerFromTaskListPrametersTypes = new Type[] { typeof(SPWeb), typeof(string) };

            object[]  parametersOfgetWorkPlannerFromTaskList = { w, list };
            Exception exception;
            var       methodInfo = this.GetMethodInfo(MethodgetWorkPlannerFromTaskList, methodgetWorkPlannerFromTaskListPrametersTypes, out exception);

            // Act
            var result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_plannerCoreInstanceFixture, _plannerCoreInstanceType, MethodgetWorkPlannerFromTaskList, Fixture, methodgetWorkPlannerFromTaskListPrametersTypes);
            var result2 = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_plannerCoreInstanceFixture, _plannerCoreInstanceType, MethodgetWorkPlannerFromTaskList, parametersOfgetWorkPlannerFromTaskList, methodgetWorkPlannerFromTaskListPrametersTypes);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();
            parametersOfgetWorkPlannerFromTaskList.ShouldNotBeNull();
            parametersOfgetWorkPlannerFromTaskList.Length.ShouldBe(2);
            methodgetWorkPlannerFromTaskListPrametersTypes.Length.ShouldBe(2);
            Should.NotThrow(() => ReflectionAnalyzer.GetResultOfStaticMethod <string>(_plannerCoreInstanceFixture, _plannerCoreInstanceType, MethodgetWorkPlannerFromTaskList, parametersOfgetWorkPlannerFromTaskList, methodgetWorkPlannerFromTaskListPrametersTypes));
        }
コード例 #10
0
        public void AUT_TitleFilterQueryService_GetTitleFilterQueryForLookup_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var list         = CreateType <SPList>();
            var userSettings = CreateType <ReportFilterUserSettings>();
            var filterValues = CreateType <StringBuilder>();
            var methodGetTitleFilterQueryForLookupPrametersTypes = new Type[] { typeof(SPList), typeof(ReportFilterUserSettings), typeof(StringBuilder) };

            object[]  parametersOfGetTitleFilterQueryForLookup = { list, userSettings, filterValues };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetTitleFilterQueryForLookup, methodGetTitleFilterQueryForLookupPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_titleFilterQueryServiceInstanceFixture, _titleFilterQueryServiceInstanceType, MethodGetTitleFilterQueryForLookup, Fixture, methodGetTitleFilterQueryForLookupPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_titleFilterQueryServiceInstanceFixture, _titleFilterQueryServiceInstanceType, MethodGetTitleFilterQueryForLookup, parametersOfGetTitleFilterQueryForLookup, methodGetTitleFilterQueryForLookupPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_titleFilterQueryServiceInstanceFixture, parametersOfGetTitleFilterQueryForLookup);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetTitleFilterQueryForLookup.ShouldNotBeNull();
            parametersOfGetTitleFilterQueryForLookup.Length.ShouldBe(3);
            methodGetTitleFilterQueryForLookupPrametersTypes.Length.ShouldBe(3);
            Should.Throw <Exception>(currentAction);
        }
コード例 #11
0
        public void AUT_GlobalResourceHelper_GetResourceString_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var resourceClass = CreateType <string>();
            var key           = CreateType <string>();
            var methodGetResourceStringPrametersTypes = new Type[] { typeof(string), typeof(string) };

            object[]  parametersOfGetResourceString = { resourceClass, key };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetResourceString, methodGetResourceStringPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_globalResourceHelperInstanceFixture, _globalResourceHelperInstanceType, MethodGetResourceString, Fixture, methodGetResourceStringPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_globalResourceHelperInstanceFixture, _globalResourceHelperInstanceType, MethodGetResourceString, parametersOfGetResourceString, methodGetResourceStringPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_globalResourceHelperInstanceFixture, parametersOfGetResourceString);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetResourceString.ShouldNotBeNull();
            parametersOfGetResourceString.Length.ShouldBe(2);
            methodGetResourceStringPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #12
0
        public void AUT_InstallSolutions_EnsureLanguagePack_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var spSolution = CreateType <SPSolution>();
            var lcid       = CreateType <uint>();
            var methodEnsureLanguagePackPrametersTypes = new Type[] { typeof(SPSolution), typeof(uint) };

            object[]  parametersOfEnsureLanguagePack = { spSolution, lcid };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodEnsureLanguagePack, methodEnsureLanguagePackPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_installSolutionsInstanceFixture, _installSolutionsInstanceType, MethodEnsureLanguagePack, Fixture, methodEnsureLanguagePackPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <SPSolutionLanguagePack>(_installSolutionsInstanceFixture, _installSolutionsInstanceType, MethodEnsureLanguagePack, parametersOfEnsureLanguagePack, methodEnsureLanguagePackPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_installSolutionsInstanceFixture, parametersOfEnsureLanguagePack);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfEnsureLanguagePack.ShouldNotBeNull();
            parametersOfEnsureLanguagePack.Length.ShouldBe(2);
            methodEnsureLanguagePackPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #13
0
        public void AUT_ChartHelper_ParseDouble_Static_Method_Call_Overloading_Of_1_With_Call_Results_Should_Not_Be_Null_Test()
        {
            // Arrange
            var doubleAsString = CreateType <string>();
            var formatProvider = CreateType <IFormatProvider>();
            var aggregateType  = CreateType <EpmChartAggregateType>();
            var isCurrency     = CreateType <Boolean>();
            var methodParseDoublePrametersTypes = new Type[] { typeof(string), typeof(IFormatProvider), typeof(EpmChartAggregateType), typeof(Boolean) };

            object[]  parametersOfParseDouble = { doubleAsString, formatProvider, aggregateType, isCurrency };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodParseDouble, methodParseDoublePrametersTypes, out exception);

            // Act
            var result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_chartHelperInstanceFixture, _chartHelperInstanceType, MethodParseDouble, Fixture, methodParseDoublePrametersTypes);
            var result2 = ReflectionAnalyzer.GetResultOfStaticMethod <double>(_chartHelperInstanceFixture, _chartHelperInstanceType, MethodParseDouble, parametersOfParseDouble, methodParseDoublePrametersTypes);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();
            result1.ShouldBe(result2);
            parametersOfParseDouble.ShouldNotBeNull();
            parametersOfParseDouble.Length.ShouldBe(4);
            methodParseDoublePrametersTypes.Length.ShouldBe(4);
            Should.NotThrow(() => ReflectionAnalyzer.GetResultOfStaticMethod <double>(_chartHelperInstanceFixture, _chartHelperInstanceType, MethodParseDouble, parametersOfParseDouble, methodParseDoublePrametersTypes));
        }
コード例 #14
0
        public void AUT_SocialEngineProxy_ProcessActivity_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var objectKind   = CreateType <ObjectKind>();
            var activityKind = CreateType <ActivityKind>();
            var data         = CreateType <Dictionary <string, object> >();
            var contextWeb   = CreateType <SPWeb>();
            var methodProcessActivityPrametersTypes = new Type[] { typeof(ObjectKind), typeof(ActivityKind), typeof(Dictionary <string, object>), typeof(SPWeb) };

            object[]  parametersOfProcessActivity = { objectKind, activityKind, data, contextWeb };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodProcessActivity, methodProcessActivityPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _socialEngineProxyInstanceType, MethodProcessActivity, Fixture, methodProcessActivityPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(null, _socialEngineProxyInstanceType, MethodProcessActivity, parametersOfProcessActivity, methodProcessActivityPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfProcessActivity);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfProcessActivity.ShouldNotBeNull();
            parametersOfProcessActivity.Length.ShouldBe(4);
            methodProcessActivityPrametersTypes.Length.ShouldBe(4);
            Should.Throw <Exception>(currentAction);
        }
コード例 #15
0
        public void AUT_WorkspaceCenter_GetSpContentDbSqlConnection_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var spWeb = CreateType <SPWeb>();
            var methodGetSpContentDbSqlConnectionPrametersTypes = new Type[] { typeof(SPWeb) };

            object[]  parametersOfGetSpContentDbSqlConnection = { spWeb };
            Exception exception, exception1;
            var       methodInfo = GetMethodInfo(MethodGetSpContentDbSqlConnection, methodGetSpContentDbSqlConnectionPrametersTypes, out exception);

            // Act
            var    result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_workspaceCenterInstanceFixture, _workspaceCenterInstanceType, MethodGetSpContentDbSqlConnection, Fixture, methodGetSpContentDbSqlConnectionPrametersTypes);
            var    result2 = ReflectionAnalyzer.GetResultOfStaticMethod <SqlConnection>(_workspaceCenterInstanceFixture, _workspaceCenterInstanceType, MethodGetSpContentDbSqlConnection, parametersOfGetSpContentDbSqlConnection, methodGetSpContentDbSqlConnectionPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_workspaceCenterInstanceFixture, parametersOfGetSpContentDbSqlConnection);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetSpContentDbSqlConnection.ShouldNotBeNull();
            parametersOfGetSpContentDbSqlConnection.Length.ShouldBe(1);
            methodGetSpContentDbSqlConnectionPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #16
0
        public void AUT_ExtensionMethods_GetRole_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var roles = CreateType <Role[]>();
            var role  = CreateType <string>();
            var methodGetRolePrametersTypes = new Type[] { typeof(Role[]), typeof(string) };

            object[]  parametersOfGetRole = { roles, role };
            Exception exception, exception1;
            var       methodInfo = GetMethodInfo(MethodGetRole, methodGetRolePrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _extensionMethodsInstanceType, MethodGetRole, Fixture, methodGetRolePrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <Role>(null, _extensionMethodsInstanceType, MethodGetRole, parametersOfGetRole, methodGetRolePrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfGetRole);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetRole.ShouldNotBeNull();
            parametersOfGetRole.Length.ShouldBe(2);
            methodGetRolePrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #17
0
        public void AUT_DataCacheAPI_BinaryToClass_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var str = CreateType <string>();
            var methodBinaryToClassPrametersTypes = new Type[] { typeof(string) };

            object[]  parametersOfBinaryToClass = { str };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodBinaryToClass, methodBinaryToClassPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_dataCacheAPIInstanceFixture, _dataCacheAPIInstanceType, MethodBinaryToClass, Fixture, methodBinaryToClassPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <object>(_dataCacheAPIInstanceFixture, _dataCacheAPIInstanceType, MethodBinaryToClass, parametersOfBinaryToClass, methodBinaryToClassPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_dataCacheAPIInstanceFixture, parametersOfBinaryToClass);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfBinaryToClass.ShouldNotBeNull();
            parametersOfBinaryToClass.Length.ShouldBe(1);
            methodBinaryToClassPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #18
0
        public void AUT_Security_AddBasicSecurityToWorkspace_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var eleWeb    = CreateType <SPWeb>();
            var safeTitle = CreateType <string>();
            var owner     = CreateType <SPUser>();
            var methodAddBasicSecurityToWorkspacePrametersTypes = new Type[] { typeof(SPWeb), typeof(string), typeof(SPUser) };

            object[]  parametersOfAddBasicSecurityToWorkspace = { eleWeb, safeTitle, owner };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodAddBasicSecurityToWorkspace, methodAddBasicSecurityToWorkspacePrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _securityInstanceType, MethodAddBasicSecurityToWorkspace, Fixture, methodAddBasicSecurityToWorkspacePrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <Dictionary <string, SPRoleType> >(null, _securityInstanceType, MethodAddBasicSecurityToWorkspace, parametersOfAddBasicSecurityToWorkspace, methodAddBasicSecurityToWorkspacePrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfAddBasicSecurityToWorkspace);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfAddBasicSecurityToWorkspace.ShouldNotBeNull();
            parametersOfAddBasicSecurityToWorkspace.Length.ShouldBe(3);
            methodAddBasicSecurityToWorkspacePrametersTypes.Length.ShouldBe(3);
            Should.Throw <Exception>(currentAction);
        }
コード例 #19
0
        public void AUT_AssociatedListItems_GetFancyFormAssociatedItemAttachments_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var data = CreateType <string>();
            var oWeb = CreateType <SPWeb>();
            var methodGetFancyFormAssociatedItemAttachmentsPrametersTypes = new Type[] { typeof(string), typeof(SPWeb) };

            object[]  parametersOfGetFancyFormAssociatedItemAttachments = { data, oWeb };
            Exception exception, exception1;
            var       methodInfo = GetMethodInfo(MethodGetFancyFormAssociatedItemAttachments, methodGetFancyFormAssociatedItemAttachmentsPrametersTypes, out exception);

            // Act
            var    result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_associatedListItemsInstanceFixture, _associatedListItemsInstanceType, MethodGetFancyFormAssociatedItemAttachments, Fixture, methodGetFancyFormAssociatedItemAttachmentsPrametersTypes);
            var    result2 = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_associatedListItemsInstanceFixture, _associatedListItemsInstanceType, MethodGetFancyFormAssociatedItemAttachments, parametersOfGetFancyFormAssociatedItemAttachments, methodGetFancyFormAssociatedItemAttachmentsPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_associatedListItemsInstanceFixture, parametersOfGetFancyFormAssociatedItemAttachments);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetFancyFormAssociatedItemAttachments.ShouldNotBeNull();
            parametersOfGetFancyFormAssociatedItemAttachments.Length.ShouldBe(2);
            methodGetFancyFormAssociatedItemAttachmentsPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #20
0
        public void AUT_QueryHelper_GetFilteredTitlesForRollup_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var web   = CreateType <SPWeb>();
            var list  = CreateType <SPList>();
            var query = CreateType <string>();
            var methodGetFilteredTitlesForRollupPrametersTypes = new Type[] { typeof(SPWeb), typeof(SPList), typeof(string) };

            object[]  parametersOfGetFilteredTitlesForRollup = { web, list, query };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetFilteredTitlesForRollup, methodGetFilteredTitlesForRollupPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _queryHelperInstanceType, MethodGetFilteredTitlesForRollup, Fixture, methodGetFilteredTitlesForRollupPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <List <string> >(null, _queryHelperInstanceType, MethodGetFilteredTitlesForRollup, parametersOfGetFilteredTitlesForRollup, methodGetFilteredTitlesForRollupPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfGetFilteredTitlesForRollup);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetFilteredTitlesForRollup.ShouldNotBeNull();
            parametersOfGetFilteredTitlesForRollup.Length.ShouldBe(3);
            methodGetFilteredTitlesForRollupPrametersTypes.Length.ShouldBe(3);
            Should.Throw <Exception>(currentAction);
        }
コード例 #21
0
        public void AUT_ListFieldIteratorExtensions_GetFormFields_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var listFieldIterator = CreateType <ListFieldIterator>();
            var methodGetFormFieldsPrametersTypes = new Type[] { typeof(ListFieldIterator) };

            object[]  parametersOfGetFormFields = { listFieldIterator };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetFormFields, methodGetFormFieldsPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _listFieldIteratorExtensionsInstanceType, MethodGetFormFields, Fixture, methodGetFormFieldsPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <List <FormField> >(null, _listFieldIteratorExtensionsInstanceType, MethodGetFormFields, parametersOfGetFormFields, methodGetFormFieldsPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfGetFormFields);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetFormFields.ShouldNotBeNull();
            parametersOfGetFormFields.Length.ShouldBe(1);
            methodGetFormFieldsPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
        public void AUT_EpmChartSeriesToVisifireChartSeriesMapper_GetVisifireChartSeries_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var chartDataSeries = CreateType <EpmChartDataSeriesList>();
            var methodGetVisifireChartSeriesPrametersTypes = new Type[] { typeof(EpmChartDataSeriesList) };

            object[]  parametersOfGetVisifireChartSeries = { chartDataSeries };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetVisifireChartSeries, methodGetVisifireChartSeriesPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _epmChartSeriesToVisifireChartSeriesMapperInstanceType, MethodGetVisifireChartSeries, Fixture, methodGetVisifireChartSeriesPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <List <VfChartSeries> >(null, _epmChartSeriesToVisifireChartSeriesMapperInstanceType, MethodGetVisifireChartSeries, parametersOfGetVisifireChartSeries, methodGetVisifireChartSeriesPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfGetVisifireChartSeries);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetVisifireChartSeries.ShouldNotBeNull();
            parametersOfGetVisifireChartSeries.Length.ShouldBe(1);
            methodGetVisifireChartSeriesPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #23
0
        public void AUT_JSONUtil_getNodeName_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var nd           = CreateType <XmlNode>();
            var idlist       = CreateType <ArrayList>();
            var arrUsedNodes = CreateType <ArrayList>();
            var nodeCounter  = CreateType <int>();
            var methodgetNodeNamePrametersTypes = new Type[] { typeof(XmlNode), typeof(ArrayList), typeof(ArrayList), typeof(int) };

            object[]  parametersOfgetNodeName = { nd, idlist, arrUsedNodes, nodeCounter };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodgetNodeName, methodgetNodeNamePrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_jSONUtilInstanceFixture, _jSONUtilInstanceType, MethodgetNodeName, Fixture, methodgetNodeNamePrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_jSONUtilInstanceFixture, _jSONUtilInstanceType, MethodgetNodeName, parametersOfgetNodeName, methodgetNodeNamePrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_jSONUtilInstanceFixture, parametersOfgetNodeName);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfgetNodeName.ShouldNotBeNull();
            parametersOfgetNodeName.Length.ShouldBe(4);
            methodgetNodeNamePrametersTypes.Length.ShouldBe(4);
            Should.Throw <Exception>(currentAction);
        }
コード例 #24
0
        public void AUT_Rates_SaveRatesInfo_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var Context = CreateType <HttpContext>();
            var xData   = CreateType <CStruct>();
            var methodSaveRatesInfoPrametersTypes = new Type[] { typeof(HttpContext), typeof(CStruct) };

            object[]  parametersOfSaveRatesInfo = { Context, xData };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodSaveRatesInfo, methodSaveRatesInfoPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_ratesInstanceFixture, _ratesInstanceType, MethodSaveRatesInfo, Fixture, methodSaveRatesInfoPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_ratesInstanceFixture, _ratesInstanceType, MethodSaveRatesInfo, parametersOfSaveRatesInfo, methodSaveRatesInfoPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_ratesInstanceFixture, parametersOfSaveRatesInfo);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfSaveRatesInfo.ShouldNotBeNull();
            parametersOfSaveRatesInfo.Length.ShouldBe(2);
            methodSaveRatesInfoPrametersTypes.Length.ShouldBe(2);
            Should.Throw <Exception>(currentAction);
        }
コード例 #25
0
        public void AUT_ListDisplayUtils_ConvertFromString_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var values = CreateType <string>();
            var methodConvertFromStringPrametersTypes = new Type[] { typeof(string) };

            object[]  parametersOfConvertFromString = { values };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodConvertFromString, methodConvertFromStringPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_listDisplayUtilsInstanceFixture, _listDisplayUtilsInstanceType, MethodConvertFromString, Fixture, methodConvertFromStringPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <Dictionary <string, Dictionary <string, string> > >(_listDisplayUtilsInstanceFixture, _listDisplayUtilsInstanceType, MethodConvertFromString, parametersOfConvertFromString, methodConvertFromStringPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_listDisplayUtilsInstanceFixture, parametersOfConvertFromString);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfConvertFromString.ShouldNotBeNull();
            parametersOfConvertFromString.Length.ShouldBe(1);
            methodConvertFromStringPrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #26
0
        public void AUT_EPKClass01_GetTableID_Static_Method_Call_With_Call_Results_Should_Not_Be_Null_Test()
        {
            // Arrange
            var iEntity   = CreateType <int>();
            var iDataType = CreateType <int>();
            var methodGetTableIDPrametersTypes = new Type[] { typeof(int), typeof(int) };

            object[]  parametersOfGetTableID = { iEntity, iDataType };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetTableID, methodGetTableIDPrametersTypes, out exception);

            // Act
            var result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_ePKClass01InstanceFixture, _ePKClass01InstanceType, MethodGetTableID, Fixture, methodGetTableIDPrametersTypes);
            var result2 = ReflectionAnalyzer.GetResultOfStaticMethod <int>(_ePKClass01InstanceFixture, _ePKClass01InstanceType, MethodGetTableID, parametersOfGetTableID, methodGetTableIDPrametersTypes);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();
            result1.ShouldBe(result2);
            parametersOfGetTableID.ShouldNotBeNull();
            parametersOfGetTableID.Length.ShouldBe(2);
            methodGetTableIDPrametersTypes.Length.ShouldBe(2);
            Should.NotThrow(() => ReflectionAnalyzer.GetResultOfStaticMethod <int>(_ePKClass01InstanceFixture, _ePKClass01InstanceType, MethodGetTableID, parametersOfGetTableID, methodGetTableIDPrametersTypes));
        }
コード例 #27
0
        public void AUT_GanttUtilities_GetImagesHashTable_Static_Method_Call_With_Call_Results_Should_Not_Be_Null_Test()
        {
            // Arrange
            var dt = CreateType <DataTable>();
            var methodGetImagesHashTablePrametersTypes = new Type[] { typeof(DataTable) };

            object[]  parametersOfGetImagesHashTable = { dt };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetImagesHashTable, methodGetImagesHashTablePrametersTypes, out exception);

            // Act
            var result1 = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_ganttUtilitiesInstanceFixture, _ganttUtilitiesInstanceType, MethodGetImagesHashTable, Fixture, methodGetImagesHashTablePrametersTypes);
            var result2 = ReflectionAnalyzer.GetResultOfStaticMethod <Hashtable>(_ganttUtilitiesInstanceFixture, _ganttUtilitiesInstanceType, MethodGetImagesHashTable, parametersOfGetImagesHashTable, methodGetImagesHashTablePrametersTypes);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldNotBeNull();
            result2.ShouldNotBeNull();
            result1.ShouldBe(result2);
            parametersOfGetImagesHashTable.ShouldNotBeNull();
            parametersOfGetImagesHashTable.Length.ShouldBe(1);
            methodGetImagesHashTablePrametersTypes.Length.ShouldBe(1);
            Should.NotThrow(() => ReflectionAnalyzer.GetResultOfStaticMethod <Hashtable>(_ganttUtilitiesInstanceFixture, _ganttUtilitiesInstanceType, MethodGetImagesHashTable, parametersOfGetImagesHashTable, methodGetImagesHashTablePrametersTypes));
        }
コード例 #28
0
        public void AUT_PFEDataServiceUtils_ConvertDateStringToJsonDate_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var m = CreateType <System.Text.RegularExpressions.Match>();
            var methodConvertDateStringToJsonDatePrametersTypes = new Type[] { typeof(System.Text.RegularExpressions.Match) };

            object[]  parametersOfConvertDateStringToJsonDate = { m };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodConvertDateStringToJsonDate, methodConvertDateStringToJsonDatePrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(_pFEDataServiceUtilsInstanceFixture, _pFEDataServiceUtilsInstanceType, MethodConvertDateStringToJsonDate, Fixture, methodConvertDateStringToJsonDatePrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(_pFEDataServiceUtilsInstanceFixture, _pFEDataServiceUtilsInstanceType, MethodConvertDateStringToJsonDate, parametersOfConvertDateStringToJsonDate, methodConvertDateStringToJsonDatePrametersTypes);
            Action currentAction = () => methodInfo.Invoke(_pFEDataServiceUtilsInstanceFixture, parametersOfConvertDateStringToJsonDate);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfConvertDateStringToJsonDate.ShouldNotBeNull();
            parametersOfConvertDateStringToJsonDate.Length.ShouldBe(1);
            methodConvertDateStringToJsonDatePrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #29
0
        public void AUT_FrequentApps_Create_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var xml = CreateType <string>();
            var methodCreatePrametersTypes = new Type[] { typeof(string) };

            object[]  parametersOfCreate = { xml };
            Exception exception, exception1;
            var       methodInfo = GetMethodInfo(MethodCreate, methodCreatePrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _frequentAppsInstanceType, MethodCreate, Fixture, methodCreatePrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <string>(null, _frequentAppsInstanceType, MethodCreate, parametersOfCreate, methodCreatePrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfCreate);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfCreate.ShouldNotBeNull();
            parametersOfCreate.Length.ShouldBe(1);
            methodCreatePrametersTypes.Length.ShouldBe(1);
            Should.Throw <Exception>(currentAction);
        }
コード例 #30
0
        public void AUT_SocialEngineProxy_GetActivities_Static_Method_Call_With_Call_Results_ShouldBe_Null_If_Not_Premitive_Type_Test()
        {
            // Arrange
            var contextWeb = CreateType <SPWeb>();
            var minDate    = CreateType <DateTime?>();
            var maxDate    = CreateType <DateTime?>();
            var page       = CreateType <int?>();
            var limit      = CreateType <int?>();
            var threadId   = CreateType <Guid?>();
            var methodGetActivitiesPrametersTypes = new Type[] { typeof(SPWeb), typeof(DateTime?), typeof(DateTime?), typeof(int?), typeof(int?), typeof(Guid?) };

            object[]  parametersOfGetActivities = { contextWeb, minDate, maxDate, page, limit, threadId };
            Exception exception;
            var       methodInfo = GetMethodInfo(MethodGetActivities, methodGetActivitiesPrametersTypes, out exception);

            // Act
            var    result1       = ReflectionAnalyzer.InvokeStaticMethodWithDynamicParameters(null, _socialEngineProxyInstanceType, MethodGetActivities, Fixture, methodGetActivitiesPrametersTypes);
            var    result2       = ReflectionAnalyzer.GetResultOfStaticMethod <DataTable>(null, _socialEngineProxyInstanceType, MethodGetActivities, parametersOfGetActivities, methodGetActivitiesPrametersTypes);
            Action currentAction = () => methodInfo.Invoke(null, parametersOfGetActivities);

            // Assert
            methodInfo.ShouldNotBeNull();
            exception.ShouldBeNull();
            result1.ShouldBeNull();
            result2.ShouldBeNull();
            parametersOfGetActivities.ShouldNotBeNull();
            parametersOfGetActivities.Length.ShouldBe(6);
            methodGetActivitiesPrametersTypes.Length.ShouldBe(6);
            Should.Throw <Exception>(currentAction);
        }