public void EditUserProfile_SaveProfile_Method_With_No_Parameters_Call_With_Reflection_Reflection_Return_Data_Test() { // Arrange Object[] parametersOfSaveProfile = {}; System.Exception exception, exception1, exception2; var editUserProfile = CreateAnalyzer.CreateOrReturnStaticInstance <EditUserProfile>(Fixture, out exception); var methodName = "SaveProfile"; if (editUserProfile != null) { // Act var saveProfileMethodInfo1 = editUserProfile.GetType().GetMethod(methodName); var saveProfileMethodInfo2 = editUserProfile.GetType().GetMethod(methodName); var returnType1 = saveProfileMethodInfo1.ReturnType; var returnType2 = saveProfileMethodInfo2.ReturnType; var result1 = saveProfileMethodInfo1.GetResultMethodInfo <EditUserProfile, string>(editUserProfile, out exception1, parametersOfSaveProfile); var result2 = saveProfileMethodInfo2.GetResultMethodInfo <EditUserProfile, string>(editUserProfile, out exception2, parametersOfSaveProfile); // Assert parametersOfSaveProfile.ShouldNotBeNull(); editUserProfile.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); saveProfileMethodInfo1.ShouldNotBeNull(); saveProfileMethodInfo2.ShouldNotBeNull(); saveProfileMethodInfo1.ShouldBe(saveProfileMethodInfo2); if (exception1 == null) { result1.ShouldBe(result2); Should.NotThrow(() => saveProfileMethodInfo1.Invoke(editUserProfile, parametersOfSaveProfile)); Should.NotThrow(() => saveProfileMethodInfo2.Invoke(editUserProfile, parametersOfSaveProfile)); } else { result1.ShouldBeNull(); result2.ShouldBeNull(); exception1.ShouldNotBeNull(); exception2.ShouldNotBeNull(); Should.Throw(() => saveProfileMethodInfo1.Invoke(editUserProfile, parametersOfSaveProfile), exceptionType: exception1.GetType()); Should.Throw(() => saveProfileMethodInfo2.Invoke(editUserProfile, parametersOfSaveProfile), exceptionType: exception2.GetType()); } } else { // Act, Assert editUserProfile.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void licensedetail_getCLID_Method_With_No_Parameters_Call_With_Reflection_Reflection_Return_Data_Test() { // Arrange Object[] parametersOfgetClid = {}; System.Exception exception, exception1, exception2; var licensedetail = CreateAnalyzer.CreateOrReturnStaticInstance <licensedetail>(Fixture, out exception); var methodName = "getCLID"; if (licensedetail != null) { // Act var getClIdMethodInfo1 = licensedetail.GetType().GetMethod(methodName); var getClIdMethodInfo2 = licensedetail.GetType().GetMethod(methodName); var returnType1 = getClIdMethodInfo1.ReturnType; var returnType2 = getClIdMethodInfo2.ReturnType; var result1 = getClIdMethodInfo1.GetResultMethodInfo <licensedetail, int>(licensedetail, out exception1, parametersOfgetClid); var result2 = getClIdMethodInfo2.GetResultMethodInfo <licensedetail, int>(licensedetail, out exception2, parametersOfgetClid); // Assert parametersOfgetClid.ShouldNotBeNull(); licensedetail.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); getClIdMethodInfo1.ShouldNotBeNull(); getClIdMethodInfo2.ShouldNotBeNull(); getClIdMethodInfo1.ShouldBe(getClIdMethodInfo2); if (exception1 == null) { result1.ShouldBe(result2); Should.NotThrow(() => getClIdMethodInfo1.Invoke(licensedetail, parametersOfgetClid)); Should.NotThrow(() => getClIdMethodInfo2.Invoke(licensedetail, parametersOfgetClid)); } else { result1.ShouldBeNull(); result2.ShouldBeNull(); exception1.ShouldNotBeNull(); exception2.ShouldNotBeNull(); Should.Throw(() => getClIdMethodInfo1.Invoke(licensedetail, parametersOfgetClid), exceptionType: exception1.GetType()); Should.Throw(() => getClIdMethodInfo2.Invoke(licensedetail, parametersOfgetClid), exceptionType: exception2.GetType()); } } else { // Act, Assert licensedetail.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void templateseditor_loadBaseChannelDropDown_Method_With_No_Parameters_Call_With_Reflection_Test() { // Arrange System.Exception exception, exception1, exception2; var templateseditor = CreateAnalyzer.CreateOrReturnStaticInstance <templateseditor>(Fixture, out exception); var methodName = "loadBaseChannelDropDown"; if (templateseditor != null) { // Act var loadBaseChannelDropDownMethodInfo1 = templateseditor.GetType().GetMethod(methodName); var loadBaseChannelDropDownMethodInfo2 = templateseditor.GetType().GetMethod(methodName); var returnType1 = loadBaseChannelDropDownMethodInfo1.ReturnType; var returnType2 = loadBaseChannelDropDownMethodInfo2.ReturnType; loadBaseChannelDropDownMethodInfo1.InvokeMethodInfo(templateseditor, out exception1); loadBaseChannelDropDownMethodInfo2.InvokeMethodInfo(templateseditor, out exception2); // Assert templateseditor.ShouldNotBeNull(); loadBaseChannelDropDownMethodInfo1.ShouldNotBeNull(); loadBaseChannelDropDownMethodInfo2.ShouldNotBeNull(); loadBaseChannelDropDownMethodInfo1.ShouldBe(loadBaseChannelDropDownMethodInfo2); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); if (exception1 == null) { Should.NotThrow(() => loadBaseChannelDropDownMethodInfo1.Invoke(templateseditor, null)); Should.NotThrow(() => loadBaseChannelDropDownMethodInfo2.Invoke(templateseditor, null)); } else { Should.Throw(() => loadBaseChannelDropDownMethodInfo1.Invoke(templateseditor, null), exceptionType: exception1.GetType()); Should.Throw(() => loadBaseChannelDropDownMethodInfo2.Invoke(templateseditor, null), exceptionType: exception2.GetType()); } } else { // Act, Assert templateseditor.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void thumbnail_sendError_Method_With_No_Parameters_Call_With_Reflection_Test() { // Arrange System.Exception exception, exception1, exception2; var thumbnail = CreateAnalyzer.CreateOrReturnStaticInstance <thumbnail>(Fixture, out exception); var methodName = "sendError"; if (thumbnail != null) { // Act var sendErrorMethodInfo1 = thumbnail.GetType().GetMethod(methodName); var sendErrorMethodInfo2 = thumbnail.GetType().GetMethod(methodName); var returnType1 = sendErrorMethodInfo1.ReturnType; var returnType2 = sendErrorMethodInfo2.ReturnType; sendErrorMethodInfo1.InvokeMethodInfo(thumbnail, out exception1); sendErrorMethodInfo2.InvokeMethodInfo(thumbnail, out exception2); // Assert thumbnail.ShouldNotBeNull(); sendErrorMethodInfo1.ShouldNotBeNull(); sendErrorMethodInfo2.ShouldNotBeNull(); sendErrorMethodInfo1.ShouldBe(sendErrorMethodInfo2); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); if (exception1 == null) { Should.NotThrow(() => sendErrorMethodInfo1.Invoke(thumbnail, null)); Should.NotThrow(() => sendErrorMethodInfo2.Invoke(thumbnail, null)); } else { Should.Throw(() => sendErrorMethodInfo1.Invoke(thumbnail, null), exceptionType: exception1.GetType()); Should.Throw(() => sendErrorMethodInfo2.Invoke(thumbnail, null), exceptionType: exception2.GetType()); } } else { // Act, Assert thumbnail.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void login_ProcessLogin_Method_With_4_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var strUser = Fixture.Create <String>(); var strPassword = Fixture.Create <String>(); var chkPersistLogin = Fixture.Create <bool>(); var redirectApp = Fixture.Create <String>(); Object[] parametersOfProcessLogin = { strUser, strPassword, chkPersistLogin, redirectApp }; System.Exception exception, invokeException; var login = CreateAnalyzer.CreateOrReturnStaticInstance <login>(Fixture, out exception); var methodName = "ProcessLogin"; // Act var processLoginMethodInfo1 = login.GetType().GetMethod(methodName); var processLoginMethodInfo2 = login.GetType().GetMethod(methodName); var returnType1 = processLoginMethodInfo1.ReturnType; var returnType2 = processLoginMethodInfo2.ReturnType; // Assert parametersOfProcessLogin.ShouldNotBeNull(); login.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); processLoginMethodInfo1.ShouldNotBeNull(); processLoginMethodInfo2.ShouldNotBeNull(); processLoginMethodInfo1.ShouldBe(processLoginMethodInfo2); if (processLoginMethodInfo1.DoesInvokeThrow(login, out invokeException, parametersOfProcessLogin)) { invokeException.ShouldNotBeNull(); Should.Throw(() => processLoginMethodInfo1.Invoke(login, parametersOfProcessLogin), exceptionType: invokeException.GetType()); Should.Throw(() => processLoginMethodInfo2.Invoke(login, parametersOfProcessLogin), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => processLoginMethodInfo1.Invoke(login, parametersOfProcessLogin)); Should.NotThrow(() => processLoginMethodInfo2.Invoke(login, parametersOfProcessLogin)); } }
public void thumbnail_newthumbSize_Method_With_3_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var currentwidth = Fixture.Create <int>(); var currentheight = Fixture.Create <int>(); var newsize = Fixture.Create <int>(); Object[] parametersOfnewthumbSize = { currentwidth, currentheight, newsize }; System.Exception exception, invokeException; var thumbnail = CreateAnalyzer.CreateOrReturnStaticInstance <thumbnail>(Fixture, out exception); var methodName = "newthumbSize"; // Act var newthumbSizeMethodInfo1 = thumbnail.GetType().GetMethod(methodName); var newthumbSizeMethodInfo2 = thumbnail.GetType().GetMethod(methodName); var returnType1 = newthumbSizeMethodInfo1.ReturnType; var returnType2 = newthumbSizeMethodInfo2.ReturnType; // Assert parametersOfnewthumbSize.ShouldNotBeNull(); thumbnail.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); newthumbSizeMethodInfo1.ShouldNotBeNull(); newthumbSizeMethodInfo2.ShouldNotBeNull(); newthumbSizeMethodInfo1.ShouldBe(newthumbSizeMethodInfo2); if (newthumbSizeMethodInfo1.DoesInvokeThrow(thumbnail, out invokeException, parametersOfnewthumbSize)) { invokeException.ShouldNotBeNull(); Should.Throw(() => newthumbSizeMethodInfo1.Invoke(thumbnail, parametersOfnewthumbSize), exceptionType: invokeException.GetType()); Should.Throw(() => newthumbSizeMethodInfo2.Invoke(thumbnail, parametersOfnewthumbSize), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => newthumbSizeMethodInfo1.Invoke(thumbnail, parametersOfnewthumbSize)); Should.NotThrow(() => newthumbSizeMethodInfo2.Invoke(thumbnail, parametersOfnewthumbSize)); } }
public void licensedetail_LoadCustomersDDfromChannels_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOfLoadCustomersDDfromChannels = { sender, e }; System.Exception exception, invokeException; var licensedetail = CreateAnalyzer.CreateOrReturnStaticInstance <licensedetail>(Fixture, out exception); var methodName = "LoadCustomersDDfromChannels"; // Act var loadCustomersDDfromChannelsMethodInfo1 = licensedetail.GetType().GetMethod(methodName); var loadCustomersDDfromChannelsMethodInfo2 = licensedetail.GetType().GetMethod(methodName); var returnType1 = loadCustomersDDfromChannelsMethodInfo1.ReturnType; var returnType2 = loadCustomersDDfromChannelsMethodInfo2.ReturnType; // Assert parametersOfLoadCustomersDDfromChannels.ShouldNotBeNull(); licensedetail.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); loadCustomersDDfromChannelsMethodInfo1.ShouldNotBeNull(); loadCustomersDDfromChannelsMethodInfo2.ShouldNotBeNull(); loadCustomersDDfromChannelsMethodInfo1.ShouldBe(loadCustomersDDfromChannelsMethodInfo2); if (loadCustomersDDfromChannelsMethodInfo1.DoesInvokeThrow(licensedetail, out invokeException, parametersOfLoadCustomersDDfromChannels)) { invokeException.ShouldNotBeNull(); Should.Throw(() => loadCustomersDDfromChannelsMethodInfo1.Invoke(licensedetail, parametersOfLoadCustomersDDfromChannels), exceptionType: invokeException.GetType()); Should.Throw(() => loadCustomersDDfromChannelsMethodInfo2.Invoke(licensedetail, parametersOfLoadCustomersDDfromChannels), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => loadCustomersDDfromChannelsMethodInfo1.Invoke(licensedetail, parametersOfLoadCustomersDDfromChannels)); Should.NotThrow(() => loadCustomersDDfromChannelsMethodInfo2.Invoke(licensedetail, parametersOfLoadCustomersDDfromChannels)); } }
public void DataFunctionsAdapter_GetDataTable_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var sql = Fixture.Create <string>(); var connectionStringName = Fixture.Create <string>(); Object[] parametersOfGetDataTable = { sql, connectionStringName }; System.Exception exception, invokeException; var dataFunctionsAdapter = CreateAnalyzer.CreateOrReturnStaticInstance <DataFunctionsAdapter>(Fixture, out exception); var methodName = "GetDataTable"; // Act var getDataTableMethodInfo1 = dataFunctionsAdapter.GetType().GetMethod(methodName); var getDataTableMethodInfo2 = dataFunctionsAdapter.GetType().GetMethod(methodName); var returnType1 = getDataTableMethodInfo1.ReturnType; var returnType2 = getDataTableMethodInfo2.ReturnType; // Assert parametersOfGetDataTable.ShouldNotBeNull(); dataFunctionsAdapter.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); getDataTableMethodInfo1.ShouldNotBeNull(); getDataTableMethodInfo2.ShouldNotBeNull(); getDataTableMethodInfo1.ShouldBe(getDataTableMethodInfo2); if (getDataTableMethodInfo1.DoesInvokeThrow(dataFunctionsAdapter, out invokeException, parametersOfGetDataTable)) { invokeException.ShouldNotBeNull(); Should.Throw(() => getDataTableMethodInfo1.Invoke(dataFunctionsAdapter, parametersOfGetDataTable), exceptionType: invokeException.GetType()); Should.Throw(() => getDataTableMethodInfo2.Invoke(dataFunctionsAdapter, parametersOfGetDataTable), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => getDataTableMethodInfo1.Invoke(dataFunctionsAdapter, parametersOfGetDataTable)); Should.NotThrow(() => getDataTableMethodInfo2.Invoke(dataFunctionsAdapter, parametersOfGetDataTable)); } }
public void templates_ddlCategoryFilter_IndexChanged_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOfddlCategoryFilterIndexChanged = { sender, e }; System.Exception exception, invokeException; var templates = CreateAnalyzer.CreateOrReturnStaticInstance <templates>(Fixture, out exception); var methodName = "ddlCategoryFilter_IndexChanged"; // Act var ddlCategoryFilterIndexChangedMethodInfo1 = templates.GetType().GetMethod(methodName); var ddlCategoryFilterIndexChangedMethodInfo2 = templates.GetType().GetMethod(methodName); var returnType1 = ddlCategoryFilterIndexChangedMethodInfo1.ReturnType; var returnType2 = ddlCategoryFilterIndexChangedMethodInfo2.ReturnType; // Assert parametersOfddlCategoryFilterIndexChanged.ShouldNotBeNull(); templates.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); ddlCategoryFilterIndexChangedMethodInfo1.ShouldNotBeNull(); ddlCategoryFilterIndexChangedMethodInfo2.ShouldNotBeNull(); ddlCategoryFilterIndexChangedMethodInfo1.ShouldBe(ddlCategoryFilterIndexChangedMethodInfo2); if (ddlCategoryFilterIndexChangedMethodInfo1.DoesInvokeThrow(templates, out invokeException, parametersOfddlCategoryFilterIndexChanged)) { invokeException.ShouldNotBeNull(); Should.Throw(() => ddlCategoryFilterIndexChangedMethodInfo1.Invoke(templates, parametersOfddlCategoryFilterIndexChanged), exceptionType: invokeException.GetType()); Should.Throw(() => ddlCategoryFilterIndexChangedMethodInfo2.Invoke(templates, parametersOfddlCategoryFilterIndexChanged), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => ddlCategoryFilterIndexChangedMethodInfo1.Invoke(templates, parametersOfddlCategoryFilterIndexChanged)); Should.NotThrow(() => ddlCategoryFilterIndexChangedMethodInfo2.Invoke(templates, parametersOfddlCategoryFilterIndexChanged)); } }
public void AccountsHomePage_HasAuthorized_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var userId = Fixture.Create <int>(); var clientId = Fixture.Create <int>(); Object[] parametersOfHasAuthorized = { userId, clientId }; System.Exception exception, invokeException; var accountsHomePage = CreateAnalyzer.CreateOrReturnStaticInstance <AccountsHomePage>(Fixture, out exception); var methodName = "HasAuthorized"; // Act var hasAuthorizedMethodInfo1 = accountsHomePage.GetType().GetMethod(methodName); var hasAuthorizedMethodInfo2 = accountsHomePage.GetType().GetMethod(methodName); var returnType1 = hasAuthorizedMethodInfo1.ReturnType; var returnType2 = hasAuthorizedMethodInfo2.ReturnType; // Assert parametersOfHasAuthorized.ShouldNotBeNull(); accountsHomePage.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); hasAuthorizedMethodInfo1.ShouldNotBeNull(); hasAuthorizedMethodInfo2.ShouldNotBeNull(); hasAuthorizedMethodInfo1.ShouldBe(hasAuthorizedMethodInfo2); if (hasAuthorizedMethodInfo1.DoesInvokeThrow(accountsHomePage, out invokeException, parametersOfHasAuthorized)) { invokeException.ShouldNotBeNull(); Should.Throw(() => hasAuthorizedMethodInfo1.Invoke(accountsHomePage, parametersOfHasAuthorized), exceptionType: invokeException.GetType()); Should.Throw(() => hasAuthorizedMethodInfo2.Invoke(accountsHomePage, parametersOfHasAuthorized), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => hasAuthorizedMethodInfo1.Invoke(accountsHomePage, parametersOfHasAuthorized)); Should.NotThrow(() => hasAuthorizedMethodInfo2.Invoke(accountsHomePage, parametersOfHasAuthorized)); } }
public void LicenseEdit_Cancel_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOfCancel = { sender, e }; System.Exception exception, invokeException; var licenseEdit = CreateAnalyzer.CreateOrReturnStaticInstance <LicenseEdit>(Fixture, out exception); var methodName = "Cancel"; // Act var cancelMethodInfo1 = licenseEdit.GetType().GetMethod(methodName); var cancelMethodInfo2 = licenseEdit.GetType().GetMethod(methodName); var returnType1 = cancelMethodInfo1.ReturnType; var returnType2 = cancelMethodInfo2.ReturnType; // Assert parametersOfCancel.ShouldNotBeNull(); licenseEdit.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); cancelMethodInfo1.ShouldNotBeNull(); cancelMethodInfo2.ShouldNotBeNull(); cancelMethodInfo1.ShouldBe(cancelMethodInfo2); if (cancelMethodInfo1.DoesInvokeThrow(licenseEdit, out invokeException, parametersOfCancel)) { invokeException.ShouldNotBeNull(); Should.Throw(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOfCancel), exceptionType: invokeException.GetType()); Should.Throw(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOfCancel), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOfCancel)); Should.NotThrow(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOfCancel)); } }
public void NotificationsSetup_btnClose_Click_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOfbtnCloseClick = { sender, e }; System.Exception exception, invokeException; var notificationsSetup = CreateAnalyzer.CreateOrReturnStaticInstance <NotificationsSetup>(Fixture, out exception); var methodName = "btnClose_Click"; // Act var btnCloseClickMethodInfo1 = notificationsSetup.GetType().GetMethod(methodName); var btnCloseClickMethodInfo2 = notificationsSetup.GetType().GetMethod(methodName); var returnType1 = btnCloseClickMethodInfo1.ReturnType; var returnType2 = btnCloseClickMethodInfo2.ReturnType; // Assert parametersOfbtnCloseClick.ShouldNotBeNull(); notificationsSetup.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); btnCloseClickMethodInfo1.ShouldNotBeNull(); btnCloseClickMethodInfo2.ShouldNotBeNull(); btnCloseClickMethodInfo1.ShouldBe(btnCloseClickMethodInfo2); if (btnCloseClickMethodInfo1.DoesInvokeThrow(notificationsSetup, out invokeException, parametersOfbtnCloseClick)) { invokeException.ShouldNotBeNull(); Should.Throw(() => btnCloseClickMethodInfo1.Invoke(notificationsSetup, parametersOfbtnCloseClick), exceptionType: invokeException.GetType()); Should.Throw(() => btnCloseClickMethodInfo2.Invoke(notificationsSetup, parametersOfbtnCloseClick), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => btnCloseClickMethodInfo1.Invoke(notificationsSetup, parametersOfbtnCloseClick)); Should.NotThrow(() => btnCloseClickMethodInfo2.Invoke(notificationsSetup, parametersOfbtnCloseClick)); } }
public void Transaction_FindTransactionByProcessedDate_Static_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var transactions = Fixture.Create <ArrayList>(); var expectedProcessDate = Fixture.Create <DateTime>(); Object[] parametersOfFindTransactionByProcessedDate = { transactions, expectedProcessDate }; System.Exception exception, invokeException; var transaction = CreateAnalyzer.CreateOrReturnStaticInstance <Transaction>(Fixture, out exception); var methodName = "FindTransactionByProcessedDate"; // Act var findTransactionByProcessedDateMethodInfo1 = transaction.GetType().GetMethod(methodName); var findTransactionByProcessedDateMethodInfo2 = transaction.GetType().GetMethod(methodName); var returnType1 = findTransactionByProcessedDateMethodInfo1.ReturnType; var returnType2 = findTransactionByProcessedDateMethodInfo2.ReturnType; // Assert parametersOfFindTransactionByProcessedDate.ShouldNotBeNull(); transaction.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); findTransactionByProcessedDateMethodInfo1.ShouldNotBeNull(); findTransactionByProcessedDateMethodInfo2.ShouldNotBeNull(); findTransactionByProcessedDateMethodInfo1.ShouldBe(findTransactionByProcessedDateMethodInfo2); if (findTransactionByProcessedDateMethodInfo1.DoesInvokeThrow(transaction, out invokeException, parametersOfFindTransactionByProcessedDate)) { invokeException.ShouldNotBeNull(); Should.Throw(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOfFindTransactionByProcessedDate), exceptionType: invokeException.GetType()); Should.Throw(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOfFindTransactionByProcessedDate), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOfFindTransactionByProcessedDate)); Should.NotThrow(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOfFindTransactionByProcessedDate)); } }
public void userdetail_Save_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOfSave = { sender, e }; System.Exception exception, invokeException; var userdetail = CreateAnalyzer.CreateOrReturnStaticInstance <userdetail>(Fixture, out exception); var methodName = "Save"; // Act var saveMethodInfo1 = userdetail.GetType().GetMethod(methodName); var saveMethodInfo2 = userdetail.GetType().GetMethod(methodName); var returnType1 = saveMethodInfo1.ReturnType; var returnType2 = saveMethodInfo2.ReturnType; // Assert parametersOfSave.ShouldNotBeNull(); userdetail.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); saveMethodInfo1.ShouldNotBeNull(); saveMethodInfo2.ShouldNotBeNull(); saveMethodInfo1.ShouldBe(saveMethodInfo2); if (saveMethodInfo1.DoesInvokeThrow(userdetail, out invokeException, parametersOfSave)) { invokeException.ShouldNotBeNull(); Should.Throw(() => saveMethodInfo1.Invoke(userdetail, parametersOfSave), exceptionType: invokeException.GetType()); Should.Throw(() => saveMethodInfo2.Invoke(userdetail, parametersOfSave), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => saveMethodInfo1.Invoke(userdetail, parametersOfSave)); Should.NotThrow(() => saveMethodInfo2.Invoke(userdetail, parametersOfSave)); } }
public void userdetail_IsContentCreator_Method_With_1_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var userId = Fixture.Create <int>(); Object[] parametersOfIsContentCreator = { userId }; System.Exception exception, invokeException; var userdetail = CreateAnalyzer.CreateOrReturnStaticInstance <userdetail>(Fixture, out exception); var methodName = "IsContentCreator"; // Act var isContentCreatorMethodInfo1 = userdetail.GetType().GetMethod(methodName); var isContentCreatorMethodInfo2 = userdetail.GetType().GetMethod(methodName); var returnType1 = isContentCreatorMethodInfo1.ReturnType; var returnType2 = isContentCreatorMethodInfo2.ReturnType; // Assert parametersOfIsContentCreator.ShouldNotBeNull(); userdetail.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); isContentCreatorMethodInfo1.ShouldNotBeNull(); isContentCreatorMethodInfo2.ShouldNotBeNull(); isContentCreatorMethodInfo1.ShouldBe(isContentCreatorMethodInfo2); if (isContentCreatorMethodInfo1.DoesInvokeThrow(userdetail, out invokeException, parametersOfIsContentCreator)) { invokeException.ShouldNotBeNull(); Should.Throw(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOfIsContentCreator), exceptionType: invokeException.GetType()); Should.Throw(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOfIsContentCreator), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOfIsContentCreator)); Should.NotThrow(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOfIsContentCreator)); } }
public void QuoteApproval_IsCreditCardValid_Method_With_1_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var creditCard = Fixture.Create <CreditCard>(); Object[] parametersOfIsCreditCardValid = { creditCard }; System.Exception exception, invokeException; var quoteApproval = CreateAnalyzer.CreateOrReturnStaticInstance <QuoteApproval>(Fixture, out exception); var methodName = "IsCreditCardValid"; // Act var isCreditCardValidMethodInfo1 = quoteApproval.GetType().GetMethod(methodName); var isCreditCardValidMethodInfo2 = quoteApproval.GetType().GetMethod(methodName); var returnType1 = isCreditCardValidMethodInfo1.ReturnType; var returnType2 = isCreditCardValidMethodInfo2.ReturnType; // Assert parametersOfIsCreditCardValid.ShouldNotBeNull(); quoteApproval.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); isCreditCardValidMethodInfo1.ShouldNotBeNull(); isCreditCardValidMethodInfo2.ShouldNotBeNull(); isCreditCardValidMethodInfo1.ShouldBe(isCreditCardValidMethodInfo2); if (isCreditCardValidMethodInfo1.DoesInvokeThrow(quoteApproval, out invokeException, parametersOfIsCreditCardValid)) { invokeException.ShouldNotBeNull(); Should.Throw(() => isCreditCardValidMethodInfo1.Invoke(quoteApproval, parametersOfIsCreditCardValid), exceptionType: invokeException.GetType()); Should.Throw(() => isCreditCardValidMethodInfo2.Invoke(quoteApproval, parametersOfIsCreditCardValid), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => isCreditCardValidMethodInfo1.Invoke(quoteApproval, parametersOfIsCreditCardValid)); Should.NotThrow(() => isCreditCardValidMethodInfo2.Invoke(quoteApproval, parametersOfIsCreditCardValid)); } }
public void templates_deleteTemplate_Method_With_1_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var templateId = Fixture.Create <int>(); Object[] parametersOfdeleteTemplate = { templateId }; System.Exception exception, invokeException; var templates = CreateAnalyzer.CreateOrReturnStaticInstance <templates>(Fixture, out exception); var methodName = "deleteTemplate"; // Act var deleteTemplateMethodInfo1 = templates.GetType().GetMethod(methodName); var deleteTemplateMethodInfo2 = templates.GetType().GetMethod(methodName); var returnType1 = deleteTemplateMethodInfo1.ReturnType; var returnType2 = deleteTemplateMethodInfo2.ReturnType; // Assert parametersOfdeleteTemplate.ShouldNotBeNull(); templates.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); deleteTemplateMethodInfo1.ShouldNotBeNull(); deleteTemplateMethodInfo2.ShouldNotBeNull(); deleteTemplateMethodInfo1.ShouldBe(deleteTemplateMethodInfo2); if (deleteTemplateMethodInfo1.DoesInvokeThrow(templates, out invokeException, parametersOfdeleteTemplate)) { invokeException.ShouldNotBeNull(); Should.Throw(() => deleteTemplateMethodInfo1.Invoke(templates, parametersOfdeleteTemplate), exceptionType: invokeException.GetType()); Should.Throw(() => deleteTemplateMethodInfo2.Invoke(templates, parametersOfdeleteTemplate), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => deleteTemplateMethodInfo1.Invoke(templates, parametersOfdeleteTemplate)); Should.NotThrow(() => deleteTemplateMethodInfo2.Invoke(templates, parametersOfdeleteTemplate)); } }
public void EditUserProfile_LoadUser_Method_With_1_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var user = Fixture.Create <User>(); Object[] parametersOfLoadUser = { user }; System.Exception exception, invokeException; var editUserProfile = CreateAnalyzer.CreateOrReturnStaticInstance <EditUserProfile>(Fixture, out exception); var methodName = "LoadUser"; // Act var loadUserMethodInfo1 = editUserProfile.GetType().GetMethod(methodName); var loadUserMethodInfo2 = editUserProfile.GetType().GetMethod(methodName); var returnType1 = loadUserMethodInfo1.ReturnType; var returnType2 = loadUserMethodInfo2.ReturnType; // Assert parametersOfLoadUser.ShouldNotBeNull(); editUserProfile.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); loadUserMethodInfo1.ShouldNotBeNull(); loadUserMethodInfo2.ShouldNotBeNull(); loadUserMethodInfo1.ShouldBe(loadUserMethodInfo2); if (loadUserMethodInfo1.DoesInvokeThrow(editUserProfile, out invokeException, parametersOfLoadUser)) { invokeException.ShouldNotBeNull(); Should.Throw(() => loadUserMethodInfo1.Invoke(editUserProfile, parametersOfLoadUser), exceptionType: invokeException.GetType()); Should.Throw(() => loadUserMethodInfo2.Invoke(editUserProfile, parametersOfLoadUser), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => loadUserMethodInfo1.Invoke(editUserProfile, parametersOfLoadUser)); Should.NotThrow(() => loadUserMethodInfo2.Invoke(editUserProfile, parametersOfLoadUser)); } }
public void AccountMenuFunctions_MenuMenuItemDataBound_Static_Method_With_4_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange var homePage = Fixture.Create <bool>(); Object[] parametersOfMenuMenuItemDataBound = { null, homePage }; System.Exception exception, invokeException; var accountMenuFunctions = CreateAnalyzer.CreateOrReturnStaticInstance <AccountMenuFunctions>(Fixture, out exception); var methodName = "MenuMenuItemDataBound"; // Act var menuMenuItemDataBoundMethodInfo1 = accountMenuFunctions.GetType().GetMethod(methodName); var menuMenuItemDataBoundMethodInfo2 = accountMenuFunctions.GetType().GetMethod(methodName); var returnType1 = menuMenuItemDataBoundMethodInfo1.ReturnType; var returnType2 = menuMenuItemDataBoundMethodInfo2.ReturnType; // Assert parametersOfMenuMenuItemDataBound.ShouldNotBeNull(); accountMenuFunctions.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); menuMenuItemDataBoundMethodInfo1.ShouldNotBeNull(); menuMenuItemDataBoundMethodInfo2.ShouldNotBeNull(); menuMenuItemDataBoundMethodInfo1.ShouldBe(menuMenuItemDataBoundMethodInfo2); if (menuMenuItemDataBoundMethodInfo1.DoesInvokeThrow(accountMenuFunctions, out invokeException, parametersOfMenuMenuItemDataBound)) { invokeException.ShouldNotBeNull(); Should.Throw(() => menuMenuItemDataBoundMethodInfo1.Invoke(accountMenuFunctions, parametersOfMenuMenuItemDataBound), exceptionType: invokeException.GetType()); Should.Throw(() => menuMenuItemDataBoundMethodInfo2.Invoke(accountMenuFunctions, parametersOfMenuMenuItemDataBound), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => menuMenuItemDataBoundMethodInfo1.Invoke(accountMenuFunctions, parametersOfMenuMenuItemDataBound)); Should.NotThrow(() => menuMenuItemDataBoundMethodInfo2.Invoke(accountMenuFunctions, parametersOfMenuMenuItemDataBound)); } }
public void EditUserProfile_SaveProfile_Method_With_No_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange Object[] parametersOutRanged = { null, null }; System.Exception exception; var editUserProfile = CreateAnalyzer.CreateOrReturnStaticInstance <EditUserProfile>(Fixture, out exception); var methodName = "SaveProfile"; if (editUserProfile != null) { // Act var saveProfileMethodInfo1 = editUserProfile.GetType().GetMethod(methodName); var saveProfileMethodInfo2 = editUserProfile.GetType().GetMethod(methodName); var returnType1 = saveProfileMethodInfo1.ReturnType; var returnType2 = saveProfileMethodInfo2.ReturnType; // Assert parametersOutRanged.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); editUserProfile.ShouldNotBeNull(); saveProfileMethodInfo1.ShouldNotBeNull(); saveProfileMethodInfo2.ShouldNotBeNull(); saveProfileMethodInfo1.ShouldBe(saveProfileMethodInfo2); Should.Throw <System.Exception>(() => saveProfileMethodInfo1.Invoke(editUserProfile, parametersOutRanged)); Should.Throw <System.Exception>(() => saveProfileMethodInfo2.Invoke(editUserProfile, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => saveProfileMethodInfo1.Invoke(editUserProfile, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => saveProfileMethodInfo2.Invoke(editUserProfile, parametersOutRanged)); } else { // Act, Assert editUserProfile.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void templateseditor_loadBaseChannelDropDown_Method_With_No_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange Object[] parametersOutRanged = { null, null }; System.Exception exception; var templateseditor = CreateAnalyzer.CreateOrReturnStaticInstance <templateseditor>(Fixture, out exception); var methodName = "loadBaseChannelDropDown"; if (templateseditor != null) { // Act var loadBaseChannelDropDownMethodInfo1 = templateseditor.GetType().GetMethod(methodName); var loadBaseChannelDropDownMethodInfo2 = templateseditor.GetType().GetMethod(methodName); var returnType1 = loadBaseChannelDropDownMethodInfo1.ReturnType; var returnType2 = loadBaseChannelDropDownMethodInfo2.ReturnType; // Assert parametersOutRanged.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); templateseditor.ShouldNotBeNull(); loadBaseChannelDropDownMethodInfo1.ShouldNotBeNull(); loadBaseChannelDropDownMethodInfo2.ShouldNotBeNull(); loadBaseChannelDropDownMethodInfo1.ShouldBe(loadBaseChannelDropDownMethodInfo2); Should.Throw <System.Exception>(() => loadBaseChannelDropDownMethodInfo1.Invoke(templateseditor, parametersOutRanged)); Should.Throw <System.Exception>(() => loadBaseChannelDropDownMethodInfo2.Invoke(templateseditor, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => loadBaseChannelDropDownMethodInfo1.Invoke(templateseditor, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => loadBaseChannelDropDownMethodInfo2.Invoke(templateseditor, parametersOutRanged)); } else { // Act, Assert templateseditor.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void licensedetail_getCLID_Method_With_No_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange Object[] parametersOutRanged = { null, null }; System.Exception exception; var licensedetail = CreateAnalyzer.CreateOrReturnStaticInstance <licensedetail>(Fixture, out exception); var methodName = "getCLID"; if (licensedetail != null) { // Act var getClIdMethodInfo1 = licensedetail.GetType().GetMethod(methodName); var getClIdMethodInfo2 = licensedetail.GetType().GetMethod(methodName); var returnType1 = getClIdMethodInfo1.ReturnType; var returnType2 = getClIdMethodInfo2.ReturnType; // Assert parametersOutRanged.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); licensedetail.ShouldNotBeNull(); getClIdMethodInfo1.ShouldNotBeNull(); getClIdMethodInfo2.ShouldNotBeNull(); getClIdMethodInfo1.ShouldBe(getClIdMethodInfo2); Should.Throw <System.Exception>(() => getClIdMethodInfo1.Invoke(licensedetail, parametersOutRanged)); Should.Throw <System.Exception>(() => getClIdMethodInfo2.Invoke(licensedetail, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => getClIdMethodInfo1.Invoke(licensedetail, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => getClIdMethodInfo2.Invoke(licensedetail, parametersOutRanged)); } else { // Act, Assert licensedetail.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void thumbnail_sendError_Method_With_No_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange Object[] parametersOutRanged = { null, null }; System.Exception exception; var thumbnail = CreateAnalyzer.CreateOrReturnStaticInstance <thumbnail>(Fixture, out exception); var methodName = "sendError"; if (thumbnail != null) { // Act var sendErrorMethodInfo1 = thumbnail.GetType().GetMethod(methodName); var sendErrorMethodInfo2 = thumbnail.GetType().GetMethod(methodName); var returnType1 = sendErrorMethodInfo1.ReturnType; var returnType2 = sendErrorMethodInfo2.ReturnType; // Assert parametersOutRanged.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); thumbnail.ShouldNotBeNull(); sendErrorMethodInfo1.ShouldNotBeNull(); sendErrorMethodInfo2.ShouldNotBeNull(); sendErrorMethodInfo1.ShouldBe(sendErrorMethodInfo2); Should.Throw <System.Exception>(() => sendErrorMethodInfo1.Invoke(thumbnail, parametersOutRanged)); Should.Throw <System.Exception>(() => sendErrorMethodInfo2.Invoke(thumbnail, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => sendErrorMethodInfo1.Invoke(thumbnail, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => sendErrorMethodInfo2.Invoke(thumbnail, parametersOutRanged)); } else { // Act, Assert thumbnail.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void Accounts_MasterRegisterButtonForPostBack_Method_With_1_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange Object[] parametersOfMasterRegisterButtonForPostBack = { null }; System.Exception exception, invokeException; var accounts = CreateAnalyzer.CreateOrReturnStaticInstance <ecn.accounts.MasterPages.Accounts>(Fixture, out exception); var methodName = "MasterRegisterButtonForPostBack"; // Act var masterRegisterButtonForPostBackMethodInfo1 = accounts.GetType().GetMethod(methodName); var masterRegisterButtonForPostBackMethodInfo2 = accounts.GetType().GetMethod(methodName); var returnType1 = masterRegisterButtonForPostBackMethodInfo1.ReturnType; var returnType2 = masterRegisterButtonForPostBackMethodInfo2.ReturnType; // Assert parametersOfMasterRegisterButtonForPostBack.ShouldNotBeNull(); accounts.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); masterRegisterButtonForPostBackMethodInfo1.ShouldNotBeNull(); masterRegisterButtonForPostBackMethodInfo2.ShouldNotBeNull(); masterRegisterButtonForPostBackMethodInfo1.ShouldBe(masterRegisterButtonForPostBackMethodInfo2); if (masterRegisterButtonForPostBackMethodInfo1.DoesInvokeThrow(accounts, out invokeException, parametersOfMasterRegisterButtonForPostBack)) { invokeException.ShouldNotBeNull(); Should.Throw(() => masterRegisterButtonForPostBackMethodInfo1.Invoke(accounts, parametersOfMasterRegisterButtonForPostBack), exceptionType: invokeException.GetType()); Should.Throw(() => masterRegisterButtonForPostBackMethodInfo2.Invoke(accounts, parametersOfMasterRegisterButtonForPostBack), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => masterRegisterButtonForPostBackMethodInfo1.Invoke(accounts, parametersOfMasterRegisterButtonForPostBack)); Should.NotThrow(() => masterRegisterButtonForPostBackMethodInfo2.Invoke(accounts, parametersOfMasterRegisterButtonForPostBack)); } }
public void EditEdition_dgVersions_DeleteCommand_Method_With_2_Parameters_Call_With_Reflection_No_Exception_Thrown_Test() { // Arrange Object[] parametersOfdgVersionsDeleteCommand = { null, null }; System.Exception exception, invokeException; var editEdition = CreateAnalyzer.CreateOrReturnStaticInstance <EditEdition>(Fixture, out exception); var methodName = "dgVersions_DeleteCommand"; // Act var dgVersionsDeleteCommandMethodInfo1 = editEdition.GetType().GetMethod(methodName); var dgVersionsDeleteCommandMethodInfo2 = editEdition.GetType().GetMethod(methodName); var returnType1 = dgVersionsDeleteCommandMethodInfo1.ReturnType; var returnType2 = dgVersionsDeleteCommandMethodInfo2.ReturnType; // Assert parametersOfdgVersionsDeleteCommand.ShouldNotBeNull(); editEdition.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); dgVersionsDeleteCommandMethodInfo1.ShouldNotBeNull(); dgVersionsDeleteCommandMethodInfo2.ShouldNotBeNull(); dgVersionsDeleteCommandMethodInfo1.ShouldBe(dgVersionsDeleteCommandMethodInfo2); if (dgVersionsDeleteCommandMethodInfo1.DoesInvokeThrow(editEdition, out invokeException, parametersOfdgVersionsDeleteCommand)) { invokeException.ShouldNotBeNull(); Should.Throw(() => dgVersionsDeleteCommandMethodInfo1.Invoke(editEdition, parametersOfdgVersionsDeleteCommand), exceptionType: invokeException.GetType()); Should.Throw(() => dgVersionsDeleteCommandMethodInfo2.Invoke(editEdition, parametersOfdgVersionsDeleteCommand), exceptionType: invokeException.GetType()); } else { invokeException.ShouldBeNull(); Should.NotThrow(() => dgVersionsDeleteCommandMethodInfo1.Invoke(editEdition, parametersOfdgVersionsDeleteCommand)); Should.NotThrow(() => dgVersionsDeleteCommandMethodInfo2.Invoke(editEdition, parametersOfdgVersionsDeleteCommand)); } }
public void NotificationsSetup_btnSave_click_Method_With_2_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOutRanged = { sender, e, null }; Object[] parametersInDifferentNumber = { sender }; System.Exception exception, exception1, exception2, exception3, exception4; var notificationsSetup = CreateAnalyzer.CreateOrReturnStaticInstance <NotificationsSetup>(Fixture, out exception); var methodName = "btnSave_click"; if (notificationsSetup != null) { // Act var btnSaveClickMethodInfo1 = notificationsSetup.GetType().GetMethod(methodName); var btnSaveClickMethodInfo2 = notificationsSetup.GetType().GetMethod(methodName); var returnType1 = btnSaveClickMethodInfo1.ReturnType; var returnType2 = btnSaveClickMethodInfo2.ReturnType; btnSaveClickMethodInfo1.InvokeMethodInfo(notificationsSetup, out exception1, parametersOutRanged); btnSaveClickMethodInfo2.InvokeMethodInfo(notificationsSetup, out exception2, parametersOutRanged); btnSaveClickMethodInfo1.InvokeMethodInfo(notificationsSetup, out exception3, parametersInDifferentNumber); btnSaveClickMethodInfo2.InvokeMethodInfo(notificationsSetup, out exception4, parametersInDifferentNumber); // Assert parametersOutRanged.ShouldNotBeNull(); parametersInDifferentNumber.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); notificationsSetup.ShouldNotBeNull(); btnSaveClickMethodInfo1.ShouldNotBeNull(); btnSaveClickMethodInfo2.ShouldNotBeNull(); if (exception1 != null) { Should.Throw(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersOutRanged)); Should.NotThrow(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersOutRanged)); } if (exception1 != null) { Should.Throw(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersOutRanged)); Should.NotThrow(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersOutRanged)); } Should.Throw <System.Exception>(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersInDifferentNumber)); Should.Throw <System.Exception>(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => btnSaveClickMethodInfo1.Invoke(notificationsSetup, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => btnSaveClickMethodInfo2.Invoke(notificationsSetup, parametersInDifferentNumber)); } else { // Act, Assert notificationsSetup.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void login_ProcessLogin_Method_With_4_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange var strUser = Fixture.Create <String>(); var strPassword = Fixture.Create <String>(); var chkPersistLogin = Fixture.Create <bool>(); var redirectApp = Fixture.Create <String>(); Object[] parametersOutRanged = { strUser, strPassword, chkPersistLogin, redirectApp, null }; Object[] parametersInDifferentNumber = { strUser, strPassword, chkPersistLogin }; System.Exception exception, exception1, exception2, exception3, exception4; var login = CreateAnalyzer.CreateOrReturnStaticInstance <login>(Fixture, out exception); var methodName = "ProcessLogin"; if (login != null) { // Act var processLoginMethodInfo1 = login.GetType().GetMethod(methodName); var processLoginMethodInfo2 = login.GetType().GetMethod(methodName); var returnType1 = processLoginMethodInfo1.ReturnType; var returnType2 = processLoginMethodInfo2.ReturnType; processLoginMethodInfo1.InvokeMethodInfo(login, out exception1, parametersOutRanged); processLoginMethodInfo2.InvokeMethodInfo(login, out exception2, parametersOutRanged); processLoginMethodInfo1.InvokeMethodInfo(login, out exception3, parametersInDifferentNumber); processLoginMethodInfo2.InvokeMethodInfo(login, out exception4, parametersInDifferentNumber); // Assert parametersOutRanged.ShouldNotBeNull(); parametersInDifferentNumber.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); login.ShouldNotBeNull(); processLoginMethodInfo1.ShouldNotBeNull(); processLoginMethodInfo2.ShouldNotBeNull(); if (exception1 != null) { Should.Throw(() => processLoginMethodInfo1.Invoke(login, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => processLoginMethodInfo2.Invoke(login, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => processLoginMethodInfo1.Invoke(login, parametersOutRanged)); Should.NotThrow(() => processLoginMethodInfo2.Invoke(login, parametersOutRanged)); } if (exception1 != null) { Should.Throw(() => processLoginMethodInfo1.Invoke(login, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => processLoginMethodInfo2.Invoke(login, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => processLoginMethodInfo1.Invoke(login, parametersOutRanged)); Should.NotThrow(() => processLoginMethodInfo2.Invoke(login, parametersOutRanged)); } Should.Throw <System.Exception>(() => processLoginMethodInfo1.Invoke(login, parametersInDifferentNumber)); Should.Throw <System.Exception>(() => processLoginMethodInfo2.Invoke(login, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => processLoginMethodInfo1.Invoke(login, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => processLoginMethodInfo2.Invoke(login, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => processLoginMethodInfo1.Invoke(login, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => processLoginMethodInfo2.Invoke(login, parametersInDifferentNumber)); } else { // Act, Assert login.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void LicenseEdit_Cancel_Method_With_2_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange var sender = Fixture.Create <object>(); var e = Fixture.Create <EventArgs>(); Object[] parametersOutRanged = { sender, e, null }; Object[] parametersInDifferentNumber = { sender }; System.Exception exception, exception1, exception2, exception3, exception4; var licenseEdit = CreateAnalyzer.CreateOrReturnStaticInstance <LicenseEdit>(Fixture, out exception); var methodName = "Cancel"; if (licenseEdit != null) { // Act var cancelMethodInfo1 = licenseEdit.GetType().GetMethod(methodName); var cancelMethodInfo2 = licenseEdit.GetType().GetMethod(methodName); var returnType1 = cancelMethodInfo1.ReturnType; var returnType2 = cancelMethodInfo2.ReturnType; cancelMethodInfo1.InvokeMethodInfo(licenseEdit, out exception1, parametersOutRanged); cancelMethodInfo2.InvokeMethodInfo(licenseEdit, out exception2, parametersOutRanged); cancelMethodInfo1.InvokeMethodInfo(licenseEdit, out exception3, parametersInDifferentNumber); cancelMethodInfo2.InvokeMethodInfo(licenseEdit, out exception4, parametersInDifferentNumber); // Assert parametersOutRanged.ShouldNotBeNull(); parametersInDifferentNumber.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); licenseEdit.ShouldNotBeNull(); cancelMethodInfo1.ShouldNotBeNull(); cancelMethodInfo2.ShouldNotBeNull(); if (exception1 != null) { Should.Throw(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOutRanged)); Should.NotThrow(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOutRanged)); } if (exception1 != null) { Should.Throw(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOutRanged)); Should.NotThrow(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOutRanged)); } Should.Throw <System.Exception>(() => cancelMethodInfo1.Invoke(licenseEdit, parametersInDifferentNumber)); Should.Throw <System.Exception>(() => cancelMethodInfo2.Invoke(licenseEdit, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => cancelMethodInfo1.Invoke(licenseEdit, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => cancelMethodInfo2.Invoke(licenseEdit, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => cancelMethodInfo1.Invoke(licenseEdit, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => cancelMethodInfo2.Invoke(licenseEdit, parametersInDifferentNumber)); } else { // Act, Assert licenseEdit.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void userdetail_IsContentCreator_Method_With_1_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange var userId = Fixture.Create <int>(); Object[] parametersOutRanged = { userId, null }; Object[] parametersInDifferentNumber = {}; System.Exception exception, exception1, exception2, exception3, exception4; var userdetail = CreateAnalyzer.CreateOrReturnStaticInstance <userdetail>(Fixture, out exception); var methodName = "IsContentCreator"; if (userdetail != null) { // Act var isContentCreatorMethodInfo1 = userdetail.GetType().GetMethod(methodName); var isContentCreatorMethodInfo2 = userdetail.GetType().GetMethod(methodName); var returnType1 = isContentCreatorMethodInfo1.ReturnType; var returnType2 = isContentCreatorMethodInfo2.ReturnType; var result1 = isContentCreatorMethodInfo1.GetResultMethodInfo <userdetail, bool>(userdetail, out exception1, parametersOutRanged); var result2 = isContentCreatorMethodInfo2.GetResultMethodInfo <userdetail, bool>(userdetail, out exception2, parametersOutRanged); var result3 = isContentCreatorMethodInfo1.GetResultMethodInfo <userdetail, bool>(userdetail, out exception3, parametersInDifferentNumber); var result4 = isContentCreatorMethodInfo2.GetResultMethodInfo <userdetail, bool>(userdetail, out exception4, parametersInDifferentNumber); // Assert parametersOutRanged.ShouldNotBeNull(); parametersInDifferentNumber.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); userdetail.ShouldNotBeNull(); isContentCreatorMethodInfo1.ShouldNotBeNull(); isContentCreatorMethodInfo2.ShouldNotBeNull(); result1.ShouldBe(result2); result3.ShouldBe(result4); if (exception1 != null) { Should.Throw(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOutRanged)); Should.NotThrow(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOutRanged)); } if (exception1 != null) { Should.Throw(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOutRanged)); Should.NotThrow(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOutRanged)); } Should.Throw <System.Exception>(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersInDifferentNumber)); Should.Throw <System.Exception>(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => isContentCreatorMethodInfo1.Invoke(userdetail, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => isContentCreatorMethodInfo2.Invoke(userdetail, parametersInDifferentNumber)); } else { // Act, Assert userdetail.ShouldBeNull(); exception.ShouldNotBeNull(); } }
public void Transaction_FindTransactionByProcessedDate_Static_Method_With_2_Parameters_Call_With_Reflection_Exception_Thrown_Test() { // Arrange var transactions = Fixture.Create <ArrayList>(); var expectedProcessDate = Fixture.Create <DateTime>(); Object[] parametersOutRanged = { transactions, expectedProcessDate, null }; Object[] parametersInDifferentNumber = { transactions }; System.Exception exception, exception1, exception2, exception3, exception4; var transaction = CreateAnalyzer.CreateOrReturnStaticInstance <Transaction>(Fixture, out exception); var methodName = "FindTransactionByProcessedDate"; if (transaction != null) { // Act var findTransactionByProcessedDateMethodInfo1 = transaction.GetType().GetMethod(methodName); var findTransactionByProcessedDateMethodInfo2 = transaction.GetType().GetMethod(methodName); var returnType1 = findTransactionByProcessedDateMethodInfo1.ReturnType; var returnType2 = findTransactionByProcessedDateMethodInfo2.ReturnType; var result1 = findTransactionByProcessedDateMethodInfo1.GetResultMethodInfo <Transaction, Transaction>(transaction, out exception1, parametersOutRanged); var result2 = findTransactionByProcessedDateMethodInfo2.GetResultMethodInfo <Transaction, Transaction>(transaction, out exception2, parametersOutRanged); var result3 = findTransactionByProcessedDateMethodInfo1.GetResultMethodInfo <Transaction, Transaction>(transaction, out exception3, parametersInDifferentNumber); var result4 = findTransactionByProcessedDateMethodInfo2.GetResultMethodInfo <Transaction, Transaction>(transaction, out exception4, parametersInDifferentNumber); // Assert parametersOutRanged.ShouldNotBeNull(); parametersInDifferentNumber.ShouldNotBeNull(); returnType1.ShouldNotBeNull(); returnType2.ShouldNotBeNull(); returnType1.ShouldBe(returnType2); transaction.ShouldNotBeNull(); findTransactionByProcessedDateMethodInfo1.ShouldNotBeNull(); findTransactionByProcessedDateMethodInfo2.ShouldNotBeNull(); result1.ShouldBe(result2); result3.ShouldBe(result4); if (exception1 != null) { Should.Throw(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOutRanged)); Should.NotThrow(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOutRanged)); } if (exception1 != null) { Should.Throw(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOutRanged), exceptionType: exception1.GetType()); Should.Throw(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOutRanged), exceptionType: exception2.GetType()); } else { Should.NotThrow(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOutRanged)); Should.NotThrow(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOutRanged)); } Should.Throw <System.Exception>(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersInDifferentNumber)); Should.Throw <System.Exception>(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersOutRanged)); Should.Throw <TargetParameterCountException>(() => findTransactionByProcessedDateMethodInfo1.Invoke(transaction, parametersInDifferentNumber)); Should.Throw <TargetParameterCountException>(() => findTransactionByProcessedDateMethodInfo2.Invoke(transaction, parametersInDifferentNumber)); } else { // Act, Assert transaction.ShouldBeNull(); exception.ShouldNotBeNull(); } }