From: Chris M. <cm...@us...> - 2007-01-10 22:56:52
|
User: cmicali Date: 07/01/10 14:56:53 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests AndroMDA.ScenarioUnit.Tests.csproj App.config TestDerivedObject.cs TestException.cs TestObject.cs TestScenarioHelperTests.cs etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties AssemblyInfo.cs etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/actual_output/TestScenarioHelperTests Placeholder.txt etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests GetMultipleTestObjects_MultipleReturnParameters.xml GetMultipleTestObjects_MultipleReturnParameters_derivedChildObj.xml GetTestObjectCollection_CollectionParameters.xml GetTestObjectList_ListParameter.xml GetTestObjectWithId_PrimitiveInputParameter.xml GetTestObject_NoInputParameter.xml ProcessMixedAsserters_CodeAssertionFailure.xml ProcessMixedAsserters_XMLAssertionFailure.xml ProcessMixedAsserters_default.xml ProcessMultipleTestObjects_MultipleInputParameters.xml ProcessTestObject_NoIgnoreRules.xml ProcessTestObject_NoRulesFile.xml ProcessTestObject_default.xml etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests GetMultipleTestObjects_MultipleReturnParameters_parentObj.xml GetTestObjectCollection_CollectionParameters_ids.xml GetTestObjectList_ListParameter_ids.xml GetTestObjectWithId_PrimitiveInputParameter_id.xml ProcessMixedDataProviders_default_testObject.xml ProcessMultipleTestObjects_MultipleInputParameters_baseChildObj.xml ProcessMultipleTestObjects_MultipleInputParameters_derivedChildObj.xml ProcessMultipleTestObjects_MultipleInputParameters_parentObj.xml ProcessTestObject_NoExpectedOutputFile_testObj.xml ProcessTestObject_NoIgnoreRules_testObj.xml ProcessTestObject_NoRulesFile_testObj.xml ProcessTestObject_default_testObj.xml TestObject.xml etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests ProcessTestObject_NoIgnoreRules.xml ProcessTestObject_default.xml etc/andromda-dotnet/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.sln etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.csproj CodeAsserterAttribute.cs CodeDataProviderAttribute.cs IAsserter.cs IDataProvider.cs TestScenarioHelper.cs XMLAsserterAttribute.cs XMLDataProviderAttribute.cs Log: - Initial import Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/AndroMDA.ScenarioUnit.Tests.csproj Index: AndroMDA.ScenarioUnit.Tests.csproj =================================================================== <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{B17535E8-28F0-481A-845F-A383F53BF0C1}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>AndroMDA.ScenarioUnit.Tests</RootNamespace> <AssemblyName>AndroMDA.ScenarioUnit.Tests</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <UseVSHostingProcess>true</UseVSHostingProcess> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="nunit.core, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.core.dll</HintPath> </Reference> <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.framework.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="TestDerivedObject.cs" /> <Compile Include="TestException.cs" /> <Compile Include="TestObject.cs" /> <Compile Include="TestScenarioHelperTests.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <None Include="App.config" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\AndroMDA.ScenarioUnit\AndroMDA.ScenarioUnit.csproj"> <Project>{0133CF39-2F87-45EB-8E8E-81C3A154FC15}</Project> <Name>AndroMDA.ScenarioUnit</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/App.config Index: App.config =================================================================== <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> <bindingRedirect oldVersion="2.0.6.0" newVersion="2.2.8.0" /> <bindingRedirect oldVersion="2.1.4.0" newVersion="2.2.8.0" /> <bindingRedirect oldVersion="2.2.0.0" newVersion="2.2.8.0" /> </dependentAssembly> </assemblyBinding> </runtime> <appSettings> <add key="TestDataInputDir" value="../../testdata/input"/> <add key="TestDataExpectedOutputDir" value="../../testdata/expected_output"/> <add key="TestDataActualOutputDir" value="../../testdata/actual_output"/> <add key="TestDataRulesDir" value="../../testdata/rules"/> </appSettings> </configuration> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestDerivedObject.cs Index: TestDerivedObject.cs =================================================================== using System; using System.Xml; using System.Xml.Serialization; using System.Collections.Generic; using System.Text; namespace AndroMDA.ScenarioUnit.Tests.TestData.Derived { public class TestDerivedObject: AndroMDA.ScenarioUnit.Tests.TestData.Base.TestObject { string middleInitial; public string MiddleInitial { get {return middleInitial;} set {middleInitial = value;} } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestException.cs Index: TestException.cs =================================================================== using System; using System.Collections.Generic; using System.Text; namespace AndroMDA.ScenarioUnit.Tests { class TestException: System.Exception { } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestObject.cs Index: TestObject.cs =================================================================== using System; using System.Xml.Serialization; using AndroMDA.ScenarioUnit.Tests.TestData.Derived; namespace AndroMDA.ScenarioUnit.Tests.TestData.Base { [XmlInclude(typeof(TestDerivedObject))] [Serializable] public class TestObject { int id; string firstName; string lastName; TestObject child; public int Id { get { return id; } set { id = value; } } public string FirstName { get { return firstName; } set { firstName = value; } } public string LastName { get { return lastName; } set { lastName = value; } } public TestObject Child { get { return child; } set { child = value; } } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestScenarioHelperTests.cs Index: TestScenarioHelperTests.cs =================================================================== using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Configuration; using System.IO; using System.Xml; using System.Xml.Serialization; using NUnit.Framework; using AndroMDA.ScenarioUnit; using AndroMDA.ScenarioUnit.Tests.TestData.Base; using AndroMDA.ScenarioUnit.Tests.TestData.Derived; namespace AndroMDA.ScenarioUnit.Tests { [TestFixture] [XMLDataProvider(InputDir = "TestScenarioHelperTests")] [XMLAsserter(ActualOutputDir = "TestScenarioHelperTests", ExpectedOutputDir = "TestScenarioHelperTests", RulesDir = "TestScenarioHelperTests")] public class TestScenarioHelperTests { #region TestInvoke [Test] public void TestInvoke() { TestScenarioHelper.Invoke("ProcessTestObject", "default", this); } [Test] [ExpectedException(typeof(FileNotFoundException))] public void TestInvokeNoInputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoInputFile", this); } [Test] [ExpectedException(typeof(FileNotFoundException))] public void TestInvokeNoExpectedOutputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoExpectedOutputFile", this); } [Test] public void TestInvokeNoRulesFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoRulesFile", this); } [Test] public void TestInvokeNoIgnoreRules() { TestScenarioHelper.Invoke("ProcessTestObject", "NoIgnoreRules", this); } private TestObject ProcessTestObject(TestObject testObj) { testObj.Id = 100; return testObj; } #endregion #region TestInvokeMultipleParameters [Test] public void TestInvokeMultipleInputParameters() { TestScenarioHelper.Invoke("ProcessMultipleTestObjects", "MultipleInputParameters", this); } private TestObject ProcessMultipleTestObjects(TestObject parentObj, TestObject baseChildObj, TestDerivedObject derivedChildObj) { parentObj.Id = 100; parentObj.Child = baseChildObj; baseChildObj.Child = derivedChildObj; return parentObj; } #endregion #region TestInvokeNoInputParameter [Test] public void TestInvokeNoInputParameter() { TestScenarioHelper.Invoke("GetTestObject", "NoInputParameter", this); } private TestObject GetTestObject() { TestObject testObj = new TestObject(); testObj.FirstName = "a"; testObj.LastName = "b"; return testObj; } #endregion #region TestInvokePrimitiveInputParameter [Test] public void TestInvokePrimitiveInputParameter() { TestScenarioHelper.Invoke("GetTestObjectWithId", "PrimitiveInputParameter", this); } private TestObject GetTestObjectWithId(int id) { TestObject testObj = new TestObject(); testObj.Id = id; testObj.FirstName = "a"; testObj.LastName = "b"; return testObj; } #endregion #region TestInvokeNoReturnParameter [Test] public void TestInvokeNoReturnParameter() { TestScenarioHelper.Invoke("NoReturn", "NoReturnParameter", this); } private void NoReturn() { return; } #endregion #region TestInvokeMultipleReturnParameters [Test] public void TestInvokeMultipleReturnParameters() { TestScenarioHelper.Invoke("GetMultipleTestObjects", "MultipleReturnParameters", this); } private TestObject GetMultipleTestObjects(TestObject parentObj, out TestDerivedObject derivedChildObj) { derivedChildObj = (TestDerivedObject)parentObj.Child; return parentObj; } #endregion #region TestInvokeCollectionParameters [Test] public void TestInvokeCollectionParameters() { TestScenarioHelper.Invoke("GetTestObjectCollection", "CollectionParameters", this); TestScenarioHelper.Invoke("GetTestObjectList", "ListParameter", this); } private TestObject[] GetTestObjectCollection(int[] ids) { TestObject[] tos = new TestObject[10]; for (int i = 0; i < ids.Length && i < 10; ++i) { TestObject to = new TestObject(); to.FirstName = ids[i].ToString(); to.LastName = string.Format("{0}", (ids[i] + 100)); tos[i] = to; } return tos; } private List<TestObject> GetTestObjectList(int[] ids) { List<TestObject> tos = new List<TestObject>(); for (int i = 0; i < ids.Length && i < 10; ++i) { TestObject to = new TestObject(); to.FirstName = ids[i].ToString(); to.LastName = string.Format("{0}", (ids[i] + 100)); tos.Add(to); } return tos; } #endregion #region TestBusinessException [Test] [ExpectedException(typeof(TestException))] public void TestBusinessException() { TestScenarioHelper.Invoke("ExceptionThrower", "default", this); } private void ExceptionThrower() { throw new TestException(); } #endregion #region TestCodeDataProvider [Test] public void TestCodeDataProvider() { TestScenarioHelper.Invoke("ProcessCodeBasedTestObject", "default", this); } [CodeDataProvider] private void ProcessCodeBasedTestObject(TestObject codeBasedTestObject) { Assert.IsNotNull(codeBasedTestObject); } private object ProcessCodeBasedTestObject_codeBasedTestObject_data(ParameterInfo pinfo, string methodName, string scenarioName) { return new TestObject(); } #endregion #region TestNamedCodeDataProvider [Test] public void TestNamedCodeDataProvider() { TestScenarioHelper.Invoke("ProcessTestObjectFromNamedMethod", "default", this); } [CodeDataProvider(DataMethodName = "TestObjectProvider")] private void ProcessTestObjectFromNamedMethod(TestObject testObject, TestDerivedObject derivedObject) { Assert.IsNotNull(testObject); Assert.IsNotNull(derivedObject); } private object TestObjectProvider(ParameterInfo pinfo, string methodName, string scenarioName) { if (pinfo.ParameterType == typeof(TestObject)) { return new TestObject(); } else if (pinfo.ParameterType == typeof(TestDerivedObject)) { return new TestDerivedObject(); } else { return null; } } #endregion #region TestMixedDataProviders [Test] public void TestMixedDataProvider() { TestScenarioHelper.Invoke("ProcessMixedDataProviders", "default", this); } [XMLDataProvider(InputDir = "TestScenarioHelperTests")] private void ProcessMixedDataProviders(TestObject testObject, [CodeDataProvider] TestDerivedObject derivedObject) { Assert.IsNotNull(testObject); Assert.IsNotNull(derivedObject); } private object ProcessMixedDataProviders_derivedObject_data(ParameterInfo pinfo, string methodName, string scenarioName) { return new TestDerivedObject(); } #endregion #region TestCodeAsserter [Test] public void TestCodeAsserter() { TestScenarioHelper.Invoke("ProcessTestObjectForCodeAssertion", "default", this); } [Test] [ExpectedException(typeof(AssertionException))] public void TestCodeAsserterFailure() { TestScenarioHelper.Invoke("ProcessTestObjectForCodeAssertion", "AssertionFailure", this); } [CodeAsserter] private TestObject ProcessTestObjectForCodeAssertion() { return new TestObject(); } private void ProcessTestObjectForCodeAssertion_Assert(object outputObj, ParameterInfo pInfo, string methodName, string scenarioName) { switch (scenarioName) { case "default": { TestObject testObject = (TestObject)outputObj; Assert.IsNotNull(testObject); break; } case "AssertionFailure": { Assert.IsNull(outputObj); break; } } } #endregion #region TestNamedCodeAsserter [Test] public void TestNamedCodeAsserter() { TestScenarioHelper.Invoke("ProcessTestObjectForNamedCodeAsserter", "scenario1", this); } [CodeAsserter(AsserterMethodName = "TestObjectAsserter")] private TestObject ProcessTestObjectForNamedCodeAsserter(out TestDerivedObject derivedObj) { TestObject testObj = new TestObject(); testObj.FirstName = "manish"; derivedObj = new TestDerivedObject(); derivedObj.FirstName = "derived"; derivedObj.MiddleInitial = "m"; return testObj; } private void TestObjectAsserter(object outputObj, ParameterInfo pinfo, string methodName, string scenarioName) { switch (scenarioName) { case "scenario1": { if (string.IsNullOrEmpty(pinfo.Name)) { Assert.AreEqual("manish", ((TestObject)outputObj).FirstName); } else if (pinfo.Name == "derivedObj") { Assert.AreEqual("m", ((TestDerivedObject)outputObj).MiddleInitial); } else { Assert.Fail("invalid return type"); } break; } default: { Assert.Fail("invalid scenarioname"); break; } } } #endregion #region TestMixedAsserters [Test] public void TestMixedAsserters() { TestScenarioHelper.Invoke("ProcessMixedAsserters", "default", this); } [Test] [ExpectedException(typeof(AssertionException))] public void TestProcessMixedAssertersXMLAssertionFailure() { TestScenarioHelper.Invoke("ProcessMixedAsserters", "XMLAssertionFailure", this); } [Test] [ExpectedException(typeof(AssertionException))] public void TestProcessMixedAssertersCodeAssertionFailure() { TestScenarioHelper.Invoke("ProcessMixedAsserters", "CodeAssertionFailure", this); } private TestObject ProcessMixedAsserters( [CodeAsserter] out TestDerivedObject derivedObject) { TestObject testObj = new TestObject(); testObj.FirstName = "manish"; derivedObject = new TestDerivedObject(); derivedObject.FirstName = "derived"; derivedObject.MiddleInitial = "m"; return testObj; } private void ProcessMixedAsserters_derivedObject_Assert(object outputObj, ParameterInfo pinfo, string methodName, string scenarioName) { switch(scenarioName) { case "default": Assert.AreEqual("m", ((TestDerivedObject)outputObj).MiddleInitial); break; case "CodeAssertionFailure": Assert.Fail("failing derived object assertion."); break; } } #endregion } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AndroMDA.ScenarioUnit.Tests")] [assembly: AssemblyDescription("This assembly contains unit tests for the AndroMDA.ScenarioUnit assembly.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("AndroMDA.org")] [assembly: AssemblyProduct("AndroMDA.ScenarioUnit.Tests")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("993676be-6a6b-4863-8544-809644564c47")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/actual_output/TestScenarioHelperTests/Placeholder.txt <<Binary file>> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetMultipleTestObjects_MultipleReturnParameters.xml Index: GetMultipleTestObjects_MultipleReturnParameters.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetMultipleTestObjects_MultipleReturnParameters_derivedChildObj.xml Index: GetMultipleTestObjects_MultipleReturnParameters_derivedChildObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestDerivedObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </TestDerivedObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObjectCollection_CollectionParameters.xml Index: GetTestObjectCollection_CollectionParameters.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfTestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <TestObject> <Id>0</Id> <FirstName>0</FirstName> <LastName>100</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>1</FirstName> <LastName>101</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>2</FirstName> <LastName>102</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>3</FirstName> <LastName>103</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>4</FirstName> <LastName>104</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>5</FirstName> <LastName>105</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>6</FirstName> <LastName>106</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>7</FirstName> <LastName>107</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>8</FirstName> <LastName>108</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>9</FirstName> <LastName>109</LastName> </TestObject> </ArrayOfTestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObjectList_ListParameter.xml Index: GetTestObjectList_ListParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfTestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <TestObject> <Id>0</Id> <FirstName>0</FirstName> <LastName>100</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>1</FirstName> <LastName>101</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>2</FirstName> <LastName>102</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>3</FirstName> <LastName>103</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>4</FirstName> <LastName>104</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>5</FirstName> <LastName>105</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>6</FirstName> <LastName>106</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>7</FirstName> <LastName>107</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>8</FirstName> <LastName>108</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>9</FirstName> <LastName>109</LastName> </TestObject> </ArrayOfTestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObjectWithId_PrimitiveInputParameter.xml Index: GetTestObjectWithId_PrimitiveInputParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObject_NoInputParameter.xml Index: GetTestObject_NoInputParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMixedAsserters_CodeAssertionFailure.xml Index: ProcessMixedAsserters_CodeAssertionFailure.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>manish</FirstName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMixedAsserters_XMLAssertionFailure.xml Index: ProcessMixedAsserters_XMLAssertionFailure.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>other</FirstName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMixedAsserters_default.xml Index: ProcessMixedAsserters_default.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>manish</FirstName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters.xml Index: ProcessMultipleTestObjects_MultipleInputParameters.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child> <Id>0</Id> <FirstName>c</FirstName> <LastName>d</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>e</FirstName> <LastName>g</LastName> <MiddleInitial>f</MiddleInitial> </Child> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessTestObject_NoIgnoreRules.xml Index: ProcessTestObject_NoIgnoreRules.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessTestObject_NoRulesFile.xml Index: ProcessTestObject_NoRulesFile.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessTestObject_default.xml Index: ProcessTestObject_default.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetMultipleTestObjects_MultipleReturnParameters_parentObj.xml Index: GetMultipleTestObjects_MultipleReturnParameters_parentObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetTestObjectCollection_CollectionParameters_ids.xml Index: GetTestObjectCollection_CollectionParameters_ids.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <int>0</int> <int>1</int> <int>2</int> <int>3</int> <int>4</int> <int>5</int> <int>6</int> <int>7</int> <int>8</int> <int>9</int> <int>10</int> </ArrayOfInt> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetTestObjectList_ListParameter_ids.xml Index: GetTestObjectList_ListParameter_ids.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <int>0</int> <int>1</int> <int>2</int> <int>3</int> <int>4</int> <int>5</int> <int>6</int> <int>7</int> <int>8</int> <int>9</int> <int>10</int> </ArrayOfInt> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetTestObjectWithId_PrimitiveInputParameter_id.xml Index: GetTestObjectWithId_PrimitiveInputParameter_id.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <int>100</int> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMixedDataProviders_default_testObject.xml Index: ProcessMixedDataProviders_default_testObject.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters_baseChildObj.xml Index: ProcessMultipleTestObjects_MultipleInputParameters_baseChildObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>c</FirstName> <LastName>d</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters_derivedChildObj.xml Index: ProcessMultipleTestObjects_MultipleInputParameters_derivedChildObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestDerivedObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>e</FirstName> <MiddleInitial>f</MiddleInitial> <LastName>g</LastName> </TestDerivedObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters_parentObj.xml Index: ProcessMultipleTestObjects_MultipleInputParameters_parentObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_NoExpectedOutputFile_testObj.xml Index: ProcessTestObject_NoExpectedOutputFile_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_NoIgnoreRules_testObj.xml Index: ProcessTestObject_NoIgnoreRules_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_NoRulesFile_testObj.xml Index: ProcessTestObject_NoRulesFile_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_default_testObj.xml Index: ProcessTestObject_default_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/TestObject.xml Index: TestObject.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests/ProcessTestObject_NoIgnoreRules.xml Index: ProcessTestObject_NoIgnoreRules.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <rules/> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests/ProcessTestObject_default.xml Index: ProcessTestObject_default.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <rules> <ignore> <item>//Id</item> </ignore> </rules> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.sln Index: AndroMDA.ScenarioUnit.sln ===================================================================  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroMDA.ScenarioUnit", "AndroMDA.ScenarioUnit\AndroMDA.ScenarioUnit.csproj", "{0133CF39-2F87-45EB-8E8E-81C3A154FC15}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroMDA.ScenarioUnit.Tests", "AndroMDA.ScenarioUnit.Tests\AndroMDA.ScenarioUnit.Tests.csproj", "{B17535E8-28F0-481A-845F-A383F53BF0C1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Debug|Any CPU.Build.0 = Debug|Any CPU {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Release|Any CPU.ActiveCfg = Release|Any CPU {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Release|Any CPU.Build.0 = Release|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj Index: AndroMDA.ScenarioUnit.csproj =================================================================== <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0133CF39-2F87-45EB-8E8E-81C3A154FC15}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>AndroMDA.ScenarioUnit</RootNamespace> <AssemblyName>AndroMDA.ScenarioUnit</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="nunit.core, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.core.dll</HintPath> </Reference> <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.framework.dll</HintPath> </Reference> <Reference Include="NXUnit.Framework, Version=1.0.0.19101, Culture=neutral"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\NXUnit.Framework.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CodeDataProviderAttribute.cs" /> <Compile Include="CodeAsserterAttribute.cs" /> <Compile Include="XMLAsserterAttribute.cs" /> <Compile Include="IAsserter.cs" /> <Compile Include="IDataProvider.cs" /> <Compile Include="TestScenarioHelper.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="XMLDataProviderAttribute.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs Index: CodeAsserterAttribute.cs =================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Parameter)] public class CodeAsserterAttribute : Attribute, IAsserter { private string _asserterMethodName; public string AsserterMethodName { get { return _asserterMethodName; } set { _asserterMethodName = value; } } public void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { if (string.IsNullOrEmpty(AsserterMethodName)) { if (string.IsNullOrEmpty(pInfo.Name)) { AsserterMethodName = string.Format("{0}_Assert", methodName); } else { AsserterMethodName = string.Format("{0}_{1}_Assert", methodName, pInfo.Name); } } MethodInfo mInfo = testFixture.GetType().GetMethod(AsserterMethodName, BindingFlags.NonPublic | BindingFlags.Instance| BindingFlags.IgnoreCase); object[] parameters = new object[] { outputObj, pInfo, methodName, scenarioName }; mInfo.Invoke(testFixture, parameters); } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs Index: CodeDataProviderAttribute.cs =================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Parameter)] public class CodeDataProviderAttribute : Attribute, IDataProvider { private string _dataMethodName; public string DataMethodName { get { return _dataMethodName; } set { _dataMethodName = value; } } public object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { if (string.IsNullOrEmpty(DataMethodName)) { DataMethodName = string.Format("{0}_{1}_Data", methodName, pInfo.Name); } MethodInfo mInfo = testFixture.GetType().GetMethod(DataMethodName, BindingFlags.NonPublic | BindingFlags.Instance| BindingFlags.IgnoreCase); object[] parameters = new object[] { pInfo, methodName, scenarioName }; return mInfo.Invoke(testFixture, parameters); } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IAsserter.cs Index: IAsserter.cs =================================================================== using System; using System.Reflection; namespace AndroMDA.ScenarioUnit { public interface IAsserter { void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture); } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IDataProvider.cs Index: IDataProvider.cs =================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { public interface IDataProvider { object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture); } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs Index: TestScenarioHelper.cs =================================================================== using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { public class TestScenarioHelper { /// <summary> /// The only public method of this class. /// this is called from test cases and does the following. /// Calls the method specified by the "methodName" attribute; /// passing in all input parameters after reading them from XML files on the disk. /// The following convention is used to determine the file name for reading in a parameter: /// methodName_scenarioName[_parameterName].xml /// The parameterName part is not present for files corresponding to the returned value from a method. /// The value returned from the method call, if any, is saved in XML format to /// a file. /// Next, for all output parameters and return values, assertions are performed by using the expected output XML files. These files are also loaded /// based on the naming convention specified above. /// Before comparing the actual and expected XML files, this method performs cleanup on the /// two XML documents and removes the nodes specified in the "rules" XML file. /// These are nodes like generated identifiers, date time fields etc. that cannot be specified in the expected output because these are determined at run time. /// The location of the four sets of files used in this process is specified by using the /// TestDataInputDir, TestDataExpectedOutputDir, TestDataActualOutputDir, and TestDataRulesDir key-value /// pairs in the configuration file of the test harness. /// </summary> /// <param name="methodName">The test method to execute. This must be a private instance method /// in the TestFixture class.</param> /// <param name="scenarioName">The test scenario.</param> /// <param name="testFixture">The class containing the test method.</param> public static void Invoke(string methodName, string scenarioName, Object testFixture) { MethodInfo mInfo = testFixture.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase); ParameterInfo[] pInfos = mInfo.GetParameters(); ParameterInfo returnParamInfo = mInfo.ReturnParameter; ArrayList allParameters = new ArrayList(); List<ParameterInfo> outParameters = new List<ParameterInfo>(); foreach (ParameterInfo pInfo in pInfos) { Object parameter = null; //Try to load a parameter from an XML //file only if it is an input parameter. //Otherwise, just add the parameterInfo for that parameter //into an array for assertion later. if (pInfo.IsOut) { outParameters.Add(pInfo); } else { IDataProvider dataProvider = GetDataProvider(testFixture, mInfo, pInfo); if (null != dataProvider) { parameter = dataProvider.GetData(pInfo, methodName, scenarioName, testFixture); } } //Add the parameter to the array to be used to call the method //irrespective of whether or not it is an out parameter. //For out parameters, a "null" is added in the array. //This is replaced by an actual object after the method is invoked. allParameters.Add(parameter); } //Call the test method. try { Object[] parameters = allParameters.ToArray(); Object returnObj = mInfo.Invoke(testFixture, parameters); //Save the returned value //and call the corresponding assertion only if the return type is not void. if (returnParamInfo.ParameterType.Name != "Void") { IAsserter outputAsserter = GetOutputAsserter(testFixture, mInfo, returnParamInfo); if (null != outputAsserter) { outputAsserter.AssertOutput(returnObj, returnParamInfo, methodName, scenarioName, testFixture); } } //Save the remaining out parameters and //call the corresponding assertions. foreach (ParameterInfo outPInfo in outParameters) { object outParameter = parameters[outPInfo.Position]; IAsserter outputAsserter = GetOutputAsserter(testFixture, mInfo, outPInfo); if (null != outputAsserter) { outputAsserter.AssertOutput(outParameter, outPInfo, me... [truncated message content] |