Click or drag to resize

LogIsTrue Method (Exception, Object, String, String)

Exception handling

Namespace:  SIC.Test.Helper
Assembly:  SIC.Test.Helper (in SIC.Test.Helper.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
public void IsTrue(
	ref Exception pException,
	Object pItem = null,
	string pDescription = "",
	string pUserName = ""
)

Parameters

pException
Type: SystemException
Exception object to analysis
pItem (Optional)
Type: SystemObject
Optional can use as data item or other return data bag (see Item property Item)
pDescription (Optional)
Type: SystemString
Optional can write a individuell description when exception object is null
pUserName (Optional)
Type: SystemString
Optional write user into protocol
Remarks
This method usage Result
Examples
Example triggers an exception because a field not exists
#region --- Execution ---
this.Log.WriteTitle("TEST EXECUTION");
this.Log.Write(System.Reflection.MethodBase.GetCurrentMethod().Name.ToString());
this.Log.Write("Import test data...");
this.Log.TestStart();
try
{
    this.AppEasyPlan.Import(this.DataDirectory + this.TestFile);
    this.ItemEasyPlanObjekt = this.AppEasyPlan.ImportItem;
}
catch (Exception ex)
{
    this.Log.IsTrue(ref ex);
}
this.Log.TestEnd();

//* protocol test execution *
this.Log.Write("Test executed");
#endregion

#region --- Analysis ---
this.Log.WriteTitle("TEST ANALYSIS");

//* conditions *
this.Log.IsTrue(this.ItemEasyPlanObjekt != null, "easyPlan data item is null", "easyPlan data item (import) OK");

//* write result of conditions *
this.Log.Result();
#endregion
Output of exception
TEST EXECUTION
TestEasyPlanAppImport
Import test data...
Test data directory:     C:\Daten\Projekte\SOWIApp\Source\easyPlanApp.Test\Data\
Test executed

TEST ANALYSIS
Test outcome:      Failed
Test duration:      00:00:01.5035550
Exception: Date Time:    25.06.2017 22:18:21
Exception.Source:        System.Data.Entity
Exception.Message:       Fehler beim Ausführen der Befehlsdefinition. Weitere Informationen finden Sie in der internen Ausnahme.
Inner Exception.Message: Invalid column name 'Widerstandsbeiwert'.
Exception call stack:    bei easyPlanApp.Data.FormStueck.GetList() in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\Data\FormStueck.cs:Zeile 70.
                         bei easyPlanApp.Data.FormStueck.GetListFormStueck(Int32 pClientID) in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\Data\FormStueck.cs:Zeile 84.
                         bei easyPlanApp.Data.AnlageKenForm.GetListForm(Int32 pClientID, Int32 pAnlagekennlinieID, List`1 pListAnlageKenForm) in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\Data\AnlageKenForm.cs:Zeile 187.
                         bei easyPlanApp.Data.AnlageKenForm.GetListForm(Int32 pClientID, Int32 pAnlagekennlinieID) in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\Data\AnlageKenForm.cs:Zeile 96.
                         bei easyPlanApp.easyPlan.GetNewDataItem() in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\easyPlan.cs:Zeile 103.
                         bei easyPlanApp.easyPlan.Import(Stream pStream, String pFileName, String pContentType) in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\easyPlan.cs:Zeile 260.
                         bei easyPlanApp.easyPlan.Import(String pFile) in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp\easyPlan.cs:Zeile 209.
                         bei easyPlanApp.Test.EasyPlanAppTestObjekt.TestEasyPlanAppImport() in C:\Daten\Projekte\SOWIApp\Source\easyPlanApp.Test\EasyPlanAppTestObjekt.cs:Zeile 220.
Call stack:              SIC.Result..ctor
  "                      SIC.Test.Helper.Log.IsTrue
  "                      easyPlanApp.Test.EasyPlanAppTestObjekt.TestEasyPlanAppImport
  "                      easyPlanApp.Test.EasyPlanAppTestObjekt.TesteasyPlanAppObjektHandling
  "                      System.RuntimeMethodHandle.InvokeMethod
  "                      System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal
  "                      System.Reflection.RuntimeMethodInfo.Invoke
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.DefaultTestMethodInvoke
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.RunTestMethod
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.ExecuteTest
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.ExecuteInternal
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.Execute
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner.RunInternal
  "                      Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner.RunSingleTest
Item:                    - No Item object -

easyPlan data item is null
See Also