From: Manish A. <mag...@us...> - 2007-03-06 10:43:20
|
User: magrawal Date: 07/03/06 02:43:20 Modified: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests TestScenarioHelperTests.cs etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.csproj CodeAsserterAttribute.cs CodeDataProviderAttribute.cs TestScenarioHelper.cs XMLAsserterAttribute.cs XMLDataProviderAttribute.cs Log: updated documentation and fixed FXCop issues. Revision Changes Path 1.4 +3 -3 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestScenarioHelperTests.cs Index: TestScenarioHelperTests.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestScenarioHelperTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- TestScenarioHelperTests.cs 18 Jan 2007 10:49:48 -0000 1.3 +++ TestScenarioHelperTests.cs 6 Mar 2007 10:43:19 -0000 1.4 @@ -26,14 +26,14 @@ TestScenarioHelper.Invoke("ProcessTestObject", "default", this); } [Test] - [ExpectedException(typeof(Exception), "Could not load data for testObj from the file ../../testdata/input\\TestScenarioHelperTests\\ProcessTestObject_NoInputFile_testObj.xml for the test method ProcessTestObject and scenario NoInputFile.")] + [ExpectedException(typeof(DataProviderException), "Could not load data for testObj from the file ../../testdata/input\\TestScenarioHelperTests\\ProcessTestObject_NoInputFile_testObj.xml for the test method ProcessTestObject and scenario NoInputFile.")] public void TestInvokeNoInputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoInputFile", this); } [Test] - [ExpectedException(typeof(Exception), "Could not load the expected output from the file ../../testdata/expected_output\\TestScenarioHelperTests\\ProcessTestObject_NoExpectedOutputFile.xml for the test method ProcessTestObject and scenario NoExpectedOutputFile.")] + [ExpectedException(typeof(AsserterException), "Could not load the expected output from the file ../../testdata/expected_output\\TestScenarioHelperTests\\ProcessTestObject_NoExpectedOutputFile.xml for the test method ProcessTestObject and scenario NoExpectedOutputFile.")] public void TestInvokeNoExpectedOutputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoExpectedOutputFile", this); @@ -405,7 +405,7 @@ #region test missing input or output files [Test] - [ExpectedException(typeof(Exception), "Could not write actual output to the file ../../testdata/actual_output\\InvalidPath\\ProcessInvalidOutputPath_InvalidActualOutputPath.xml for the test method ProcessInvalidOutputPath and scenario InvalidActualOutputPath.")] + [ExpectedException(typeof(AsserterException), "Could not write actual output to the file ../../testdata/actual_output\\InvalidPath\\ProcessInvalidOutputPath_InvalidActualOutputPath.xml for the test method ProcessInvalidOutputPath and scenario InvalidActualOutputPath.")] public void TestInvokeInvalidActualOutputPath() { TestScenarioHelper.Invoke("ProcessInvalidOutputPath", "InvalidActualOutputPath", this); 1.4 +4 -0 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj Index: AndroMDA.ScenarioUnit.csproj =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- AndroMDA.ScenarioUnit.csproj 19 Feb 2007 06:54:19 -0000 1.3 +++ AndroMDA.ScenarioUnit.csproj 6 Mar 2007 10:43:19 -0000 1.4 @@ -20,6 +20,8 @@ <WarningLevel>4</WarningLevel> <PlatformTarget>AnyCPU</PlatformTarget> <DocumentationFile>bin\debug\AndroMDA.ScenarioUnit.XML</DocumentationFile> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRules>-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1305</CodeAnalysisRules> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -48,8 +50,10 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="AsserterException.cs" /> <Compile Include="CodeDataProviderAttribute.cs" /> <Compile Include="CodeAsserterAttribute.cs" /> + <Compile Include="DataProviderException.cs" /> <Compile Include="XMLAsserterAttribute.cs" /> <Compile Include="IAsserter.cs" /> <Compile Include="IDataProvider.cs" /> 1.3 +2 -2 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs Index: CodeAsserterAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- CodeAsserterAttribute.cs 19 Feb 2007 06:54:19 -0000 1.2 +++ CodeAsserterAttribute.cs 6 Mar 2007 10:43:19 -0000 1.3 @@ -12,7 +12,7 @@ /// This asserter is similar to the traditional mechanism of using /// helper methods to separate out assertion logic from the main testing code. /// <para> - /// This asserter is helpful when used in conjunction with <see cref="XmlAsserter"/> for return values/output parameters + /// This asserter is helpful when used in conjunction with <see cref="XMLAsserterAttribute"/> for return values/output parameters /// that cannot be serialized into XML. /// </para> /// <para> @@ -35,7 +35,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class CodeAsserterAttribute + public sealed class CodeAsserterAttribute : Attribute, IAsserter { 1.4 +4 -4 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs Index: CodeDataProviderAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- CodeDataProviderAttribute.cs 19 Feb 2007 06:54:19 -0000 1.3 +++ CodeDataProviderAttribute.cs 6 Mar 2007 10:43:19 -0000 1.4 @@ -15,8 +15,8 @@ /// This method of loading test data is almost the same as the mechanism used in /// traditional unit testing where test data is separated out into helper methods. /// This data provider is useful when used in conjunction with the - /// <see cref="XMLDataProvider"/> for input data types that cannot be serialized into XML - /// and therefore cannot be loaded using <see cref="XMlDataProvider"/>. + /// <see cref="XMLDataProviderAttribute"/> for input data types that cannot be serialized into XML + /// and therefore cannot be loaded using <see cref="XMLDataProviderAttribute"/>. /// <para> /// This class derives from the <c>System.Attribute</c> class. This /// allows this class to be configured as a data provider for a test method parameter. @@ -36,7 +36,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class CodeDataProviderAttribute + public sealed class CodeDataProviderAttribute : Attribute, IDataProvider { @@ -115,7 +115,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load data for {0} from the method {1} for the test method {2} and scenario {3}.", pInfo.Name, DataMethodName, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new DataProviderException(errorMessage, e); } } } 1.3 +5 -4 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs Index: TestScenarioHelper.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- TestScenarioHelper.cs 19 Feb 2007 06:54:19 -0000 1.2 +++ TestScenarioHelper.cs 6 Mar 2007 10:43:19 -0000 1.3 @@ -5,9 +5,7 @@ using System.Reflection; -///<summary> -///This namespace contains the various classes for the AndroMDA.ScenarioUnit library. -///</summary> + namespace AndroMDA.ScenarioUnit { /// <summary> @@ -49,7 +47,10 @@ /// </remarks> public class TestScenarioHelper { - + /// <summary> + /// Making the constructor protected so that this class is + /// not instantiated. + /// </summary> protected TestScenarioHelper() { } /// <summary> 1.5 +7 -7 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLAsserterAttribute.cs Index: XMLAsserterAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLAsserterAttribute.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- XMLAsserterAttribute.cs 19 Feb 2007 06:54:19 -0000 1.4 +++ XMLAsserterAttribute.cs 6 Mar 2007 10:43:19 -0000 1.5 @@ -21,7 +21,7 @@ /// Internally, it uses an open source XML-based unit testing framework called /// NXUnit <see ref="http://www.sf.net/NXUnit"/> to perform the XML comparisons. /// <para> - /// Similar to the <see cref="XMLDataProvider"/>, this asserter also uses the + /// Similar to the <see cref="XMLDataProviderAttribute"/>, this asserter also uses the /// XML format produced by serializing an object using the System.Xml.Serialization.XmlSerializer class. /// This means that this asserter can be used to assert only those return/output types /// that can be serialized into XML. @@ -79,7 +79,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class XMLAsserterAttribute + public sealed class XMLAsserterAttribute : Attribute, IAsserter { #region properties @@ -226,7 +226,7 @@ /// </para> /// <para> /// The name of the physical file is created using the same naming convention as that used - /// by the <see cref="XMLDataProvider"/> class: methodName_scenarioName_parameterName.xml. + /// by the <see cref="XMLDataProviderAttribute"/> class: methodName_scenarioName_parameterName.xml. /// <note> /// In case of return parameters, there is no "parameterName", so, the file name is just methodName_scenarioName.xml. /// </note> @@ -317,7 +317,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not write actual output to the file {0} for the test method {1} and scenario {2}.", actualOutputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } } @@ -348,7 +348,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load the assertion rules from the file {0} for the test method {1} and scenario {2}.", rulesPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } XmlDocument actualXml = new XmlDocument(); @@ -360,7 +360,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load the actual output from the file {0} for the test method {1} and scenario {2}.", actualOutputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } XmlDocument expectedXml = new XmlDocument(); @@ -372,7 +372,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load the expected output from the file {0} for the test method {1} and scenario {2}.", expectedOutputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new AsserterException(errorMessage, e); } XMLInput actual = XMLInput.CreateInput(actualXml); 1.4 +3 -3 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLDataProviderAttribute.cs Index: XMLDataProviderAttribute.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/XMLDataProviderAttribute.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- XMLDataProviderAttribute.cs 19 Feb 2007 06:54:19 -0000 1.3 +++ XMLDataProviderAttribute.cs 6 Mar 2007 10:43:19 -0000 1.4 @@ -47,7 +47,7 @@ /// </para> /// </remarks> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter)] - public class XMLDataProviderAttribute + public sealed class XMLDataProviderAttribute : Attribute, IDataProvider { #region member variables and properties. @@ -57,7 +57,7 @@ /// This property is used in conjunction with the /// configuration entry /// <code escaped="true"> - /// <add key="TestDataInputDir" value="[some path]"> + /// <add key="TestDataInputDir" value="[some path]"/> /// </code> /// This configuration entry specifies the directory that contains all input data XML files. /// This property is used to specify a sub-directory below the TestDataInputDir @@ -182,7 +182,7 @@ catch (Exception e) { string errorMessage = string.Format("Could not load data for {0} from the file {1} for the test method {2} and scenario {3}.", pInfo.Name, inputPath, methodName, scenarioName); - throw new Exception(errorMessage, e); + throw new DataProviderException(errorMessage, e); } } |