Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Organized lib folders into a directory structure, moved RunTimeCodeGe…

…nerator, RunTimeCodeGenerator.Tests projects into their own project and added RunTimeCodeGenerator dll to lib folder
  • Loading branch information...
commit bf22fc655e944c16ad40457a6d68088075cbf78a 1 parent 8cc58db
@shashankshetty shashankshetty authored
Showing with 28 additions and 1,374 deletions.
  1. +1 −21 ExcelMapper.build
  2. BIN  lib/ExcelToDTOMapper.DTO.dll
  3. 0  lib/{ → NUnit}/nunit.framework.dll
  4. 0  lib/{ → NUnit}/nunit.framework.extensions.dll
  5. 0  lib/{ → NUnit}/nunit.framework.xml
  6. 0  lib/{ → RhinoMocks}/Rhino.Mocks.dll
  7. 0  lib/{ → RhinoMocks}/Rhino.Mocks.xml
  8. BIN  lib/RunTimeCodeGenerator/RunTimeCodeGenerator.dll
  9. BIN  lib/RunTimeCodeGenerator/RunTimeCodeGenerator.pdb
  10. 0  lib/{ → ServiceLocator}/Microsoft.Practices.ServiceLocation.XML
  11. 0  lib/{ → ServiceLocator}/Microsoft.Practices.ServiceLocation.dll
  12. 0  lib/{ → StructureMap}/StructureMap.AutoMocking.dll
  13. 0  lib/{ → StructureMap}/StructureMap.AutoMocking.xml
  14. 0  lib/{ → StructureMap}/StructureMap.dll
  15. 0  lib/{ → StructureMap}/StructureMap.xml
  16. +3 −3 src/BuildDTOsFromExcel.Tests/BuildDTOsFromExcel.Tests.csproj
  17. +1 −5 src/BuildDTOsFromExcel/BuildDTOsFromExcel.csproj
  18. +13 −17 src/ExcelMapper.Tests/ExcelMapper.Tests.csproj
  19. +0 −16 src/ExcelMapper.sln
  20. +7 −9 src/ExcelMapper/ExcelMapper.csproj
  21. +0 −80 src/RunTimeCodeGenerator.Tests/AssemblyGeneration/AssemblyGeneratorTests.cs
  22. +0 −125 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassFileGeneratorTests.cs
  23. +0 −74 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassFileWriterTests.cs
  24. +0 −14 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassWithMethods.cs
  25. +0 −14 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassWithMethodsWithParameters.cs
  26. +0 −7 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassWithProperties.cs
  27. +0 −32 src/RunTimeCodeGenerator.Tests/Logging/FileListenerTests.cs
  28. +0 −36 src/RunTimeCodeGenerator.Tests/Logging/LogTests.cs
  29. +0 −26 src/RunTimeCodeGenerator.Tests/Logging/LoggerTests.cs
  30. +0 −36 src/RunTimeCodeGenerator.Tests/Properties/AssemblyInfo.cs
  31. +0 −90 src/RunTimeCodeGenerator.Tests/RunTimeCodeGenerator.Tests.csproj
  32. +0 −11 src/RunTimeCodeGenerator.Tests/TestData.cs
  33. +0 −32 src/RunTimeCodeGenerator/AssemblyGeneration/AssemblyAttributes.cs
  34. +0 −47 src/RunTimeCodeGenerator/AssemblyGeneration/AssemblyGenerator.cs
  35. +0 −7 src/RunTimeCodeGenerator/AssemblyGeneration/IAssemblyGenerator.cs
  36. +0 −27 src/RunTimeCodeGenerator/BootStrapper.cs
  37. +0 −16 src/RunTimeCodeGenerator/ClassGeneration/AccessLevel.cs
  38. +0 −41 src/RunTimeCodeGenerator/ClassGeneration/ClassAttributes.cs
  39. +0 −121 src/RunTimeCodeGenerator/ClassGeneration/ClassFileGenerator.cs
  40. +0 −52 src/RunTimeCodeGenerator/ClassGeneration/ClassFileWriter.cs
  41. +0 −10 src/RunTimeCodeGenerator/ClassGeneration/ClassGenerator.cs
  42. +0 −12 src/RunTimeCodeGenerator/ClassGeneration/IClassFileWriter.cs
  43. +0 −7 src/RunTimeCodeGenerator/ClassGeneration/IClassGenerator.cs
  44. +0 −24 src/RunTimeCodeGenerator/ClassGeneration/Method.cs
  45. +0 −25 src/RunTimeCodeGenerator/ClassGeneration/Parameter.cs
  46. +0 −18 src/RunTimeCodeGenerator/ClassGeneration/Property.cs
  47. +0 −7 src/RunTimeCodeGenerator/DefaultSettings.cs
  48. +0 −12 src/RunTimeCodeGenerator/Logging/ConsoleListener.cs
  49. +0 −23 src/RunTimeCodeGenerator/Logging/FileListener.cs
  50. +0 −7 src/RunTimeCodeGenerator/Logging/IListener.cs
  51. +0 −9 src/RunTimeCodeGenerator/Logging/ILogFactory.cs
  52. +0 −17 src/RunTimeCodeGenerator/Logging/ILogger.cs
  53. +0 −15 src/RunTimeCodeGenerator/Logging/Log.cs
  54. +0 −15 src/RunTimeCodeGenerator/Logging/LogFactory.cs
  55. +0 −50 src/RunTimeCodeGenerator/Logging/Logger.cs
  56. +0 −16 src/RunTimeCodeGenerator/Logging/MessageType.cs
  57. +0 −36 src/RunTimeCodeGenerator/Properties/AssemblyInfo.cs
  58. +0 −89 src/RunTimeCodeGenerator/RunTimeCodeGenerator.csproj
  59. +0 −20 src/RunTimeCodeGenerator/RunTimeCodeGeneratorRegistry.cs
  60. +1 −1  src/Samples.Tests/ReadWriteExistingExcelFileTests.cs
  61. +2 −2 src/Samples.Tests/Samples.Tests.csproj
View
22 ExcelMapper.build
@@ -24,12 +24,6 @@
<arg value="/nologo"/>
</msbuild>
- <echo message="Copying artifacts to build directory"/>
- <copy todir="${build.dir}" overwrite="true">
- <fileset basedir="src\RunTimeCodeGenerator\bin\Debug">
- <include name="*.*" />
- </fileset>
- </copy>
<copy todir="${build.dir}" overwrite="true">
<fileset basedir="src\ExcelMapper\bin\Debug">
<include name="*.*" />
@@ -42,12 +36,6 @@
</copy>
<copy todir="${build.dir}" overwrite="true">
- <fileset basedir="src\RunTimeCodeGenerator.Tests\bin\Debug">
- <include name="*" />
- <include name="**\*.*" />
- </fileset>
- </copy>
- <copy todir="${build.dir}" overwrite="true">
<fileset basedir="src\ExcelMapper.Tests\bin\Debug">
<include name="*" />
<include name="**\*.*" />
@@ -67,18 +55,10 @@
</copy>
</target>
- <target name="test" depends="RunTimeCodeGeneratorTests, ExcelMapperTests, BuildDTOsFromExcel" />
+ <target name="test" depends="ExcelMapperTests, BuildDTOsFromExcel" />
<target name="build" depends="compile, test, updateSampleExcel" description="Clean, Compile, run tests" />
- <target name="RunTimeCodeGeneratorTests">
- <exec program="${nunit-console.exe}" workingdir="${build.dir}">
- <arg value="RunTimeCodeGenerator.Tests.dll" />
- <arg value="/xml:RunTimeCodeGeneratorTests.xml" />
- <arg value="/nologo" />
- </exec>
- </target>
-
<target name="ExcelMapperTests">
<exec program="${nunit-console.exe}" workingdir="${build.dir}">
<arg value="ExcelMapper.Tests.dll" />
View
BIN  lib/ExcelToDTOMapper.DTO.dll
Binary file not shown
View
0  lib/nunit.framework.dll → lib/NUnit/nunit.framework.dll
File renamed without changes
View
0  lib/nunit.framework.extensions.dll → lib/NUnit/nunit.framework.extensions.dll
File renamed without changes
View
0  lib/nunit.framework.xml → lib/NUnit/nunit.framework.xml
File renamed without changes
View
0  lib/Rhino.Mocks.dll → lib/RhinoMocks/Rhino.Mocks.dll
File renamed without changes
View
0  lib/Rhino.Mocks.xml → lib/RhinoMocks/Rhino.Mocks.xml
File renamed without changes
View
BIN  lib/RunTimeCodeGenerator/RunTimeCodeGenerator.dll
Binary file not shown
View
BIN  lib/RunTimeCodeGenerator/RunTimeCodeGenerator.pdb
Binary file not shown
View
0  lib/Microsoft.Practices.ServiceLocation.XML → ...ceLocator/Microsoft.Practices.ServiceLocation.XML
File renamed without changes
View
0  lib/Microsoft.Practices.ServiceLocation.dll → ...ceLocator/Microsoft.Practices.ServiceLocation.dll
File renamed without changes
View
0  lib/StructureMap.AutoMocking.dll → lib/StructureMap/StructureMap.AutoMocking.dll
File renamed without changes
View
0  lib/StructureMap.AutoMocking.xml → lib/StructureMap/StructureMap.AutoMocking.xml
File renamed without changes
View
0  lib/StructureMap.dll → lib/StructureMap/StructureMap.dll
File renamed without changes
View
0  lib/StructureMap.xml → lib/StructureMap/StructureMap.xml
File renamed without changes
View
6 src/BuildDTOsFromExcel.Tests/BuildDTOsFromExcel.Tests.csproj
@@ -34,15 +34,15 @@
<ItemGroup>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\lib\ServiceLocator\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\nunit.framework.dll</HintPath>
+ <HintPath>..\..\lib\NUnit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=3.5.0.1337, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Rhino.Mocks.dll</HintPath>
+ <HintPath>..\..\lib\RhinoMocks\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
View
6 src/BuildDTOsFromExcel/BuildDTOsFromExcel.csproj
@@ -34,11 +34,7 @@
<ItemGroup>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
- </Reference>
- <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\StructureMap.dll</HintPath>
+ <HintPath>..\..\lib\ServiceLocator\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
View
30 src/ExcelMapper.Tests/ExcelMapper.Tests.csproj
@@ -49,23 +49,23 @@
<ItemGroup>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\lib\ServiceLocator\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\nunit.framework.dll</HintPath>
+ <HintPath>..\..\lib\NUnit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=3.5.0.1337, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Rhino.Mocks.dll</HintPath>
+ <HintPath>..\..\lib\RhinoMocks\Rhino.Mocks.dll</HintPath>
</Reference>
- <Reference Include="StructureMap, Version=2.5.4.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <Reference Include="RunTimeCodeGenerator, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\StructureMap.dll</HintPath>
+ <HintPath>..\..\lib\RunTimeCodeGenerator\RunTimeCodeGenerator.dll</HintPath>
</Reference>
- <Reference Include="StructureMap.AutoMocking, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <Reference Include="StructureMap.AutoMocking, Version=2.5.4.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\StructureMap.AutoMocking.dll</HintPath>
+ <HintPath>..\..\lib\StructureMap\StructureMap.AutoMocking.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
@@ -92,16 +92,6 @@
<Compile Include="TestData.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\ExcelMapper\ExcelMapper.csproj">
- <Project>{CB8A10B6-9E2E-4228-B945-9C375577AF88}</Project>
- <Name>ExcelMapper</Name>
- </ProjectReference>
- <ProjectReference Include="..\RunTimeCodeGenerator\RunTimeCodeGenerator.csproj">
- <Project>{641B6388-773E-48B1-B41C-DBD631512129}</Project>
- <Name>RunTimeCodeGenerator</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<None Include="Excel\UsersXls.xls">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -114,6 +104,12 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\ExcelMapper\ExcelMapper.csproj">
+ <Project>{CB8A10B6-9E2E-4228-B945-9C375577AF88}</Project>
+ <Name>ExcelMapper</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\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.
View
16 src/ExcelMapper.sln
@@ -9,10 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildDTOsFromExcel", "Build
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildDTOsFromExcel.Tests", "BuildDTOsFromExcel.Tests\BuildDTOsFromExcel.Tests.csproj", "{277C7C58-4C41-4088-87FB-3C4CEDDCA522}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunTimeCodeGenerator", "RunTimeCodeGenerator\RunTimeCodeGenerator.csproj", "{641B6388-773E-48B1-B41C-DBD631512129}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunTimeCodeGenerator.Tests", "RunTimeCodeGenerator.Tests\RunTimeCodeGenerator.Tests.csproj", "{AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Tests", "Samples.Tests\Samples.Tests.csproj", "{82FA6A9D-5306-41EA-955B-C8A7B6E05607}"
EndProject
Global
@@ -53,18 +49,6 @@ Global
{277C7C58-4C41-4088-87FB-3C4CEDDCA522}.Release|Any CPU.ActiveCfg = Release|Any CPU
{277C7C58-4C41-4088-87FB-3C4CEDDCA522}.Release|Any CPU.Build.0 = Release|Any CPU
{277C7C58-4C41-4088-87FB-3C4CEDDCA522}.Release|x86.ActiveCfg = Release|Any CPU
- {641B6388-773E-48B1-B41C-DBD631512129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {641B6388-773E-48B1-B41C-DBD631512129}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {641B6388-773E-48B1-B41C-DBD631512129}.Debug|x86.ActiveCfg = Debug|Any CPU
- {641B6388-773E-48B1-B41C-DBD631512129}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {641B6388-773E-48B1-B41C-DBD631512129}.Release|Any CPU.Build.0 = Release|Any CPU
- {641B6388-773E-48B1-B41C-DBD631512129}.Release|x86.ActiveCfg = Release|Any CPU
- {AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}.Debug|x86.ActiveCfg = Debug|Any CPU
- {AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}.Release|Any CPU.Build.0 = Release|Any CPU
- {AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}.Release|x86.ActiveCfg = Release|Any CPU
{82FA6A9D-5306-41EA-955B-C8A7B6E05607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82FA6A9D-5306-41EA-955B-C8A7B6E05607}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82FA6A9D-5306-41EA-955B-C8A7B6E05607}.Debug|x86.ActiveCfg = Debug|Any CPU
View
16 src/ExcelMapper/ExcelMapper.csproj
@@ -49,11 +49,15 @@
<ItemGroup>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\lib\ServiceLocator\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
- <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <Reference Include="RunTimeCodeGenerator, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\StructureMap.dll</HintPath>
+ <HintPath>..\..\lib\RunTimeCodeGenerator\RunTimeCodeGenerator.dll</HintPath>
+ </Reference>
+ <Reference Include="StructureMap, Version=2.5.4.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\StructureMap\StructureMap.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
@@ -92,12 +96,6 @@
<Compile Include="Repository\StringExtensions.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\RunTimeCodeGenerator\RunTimeCodeGenerator.csproj">
- <Project>{641B6388-773E-48B1-B41C-DBD631512129}</Project>
- <Name>RunTimeCodeGenerator</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
View
80 src/RunTimeCodeGenerator.Tests/AssemblyGeneration/AssemblyGeneratorTests.cs
@@ -1,80 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-
-using NUnit.Framework;
-
-using RunTimeCodeGenerator.AssemblyGeneration;
-using RunTimeCodeGenerator.ClassGeneration;
-
-namespace RunTimeCodeGenerator.Tests.AssemblyGeneration
-{
- public class AssemblyGeneratorTests
- {
- [TestFixture]
- public class When_given_a_list_of_class_files
- {
- private IClassGenerator _classGenerator;
- private IAssemblyGenerator _assemblyGenerator;
- private ClassAttributes _classAttributes;
- private AssemblyAttributes _assemblyAttributes;
- private string[] _classNames;
-
- [TestFixtureSetUp]
- public void TestFixtureSetUp()
- {
- File.Delete(TestData.LogFile);
- }
-
- [SetUp]
- public void SetUp()
- {
- BootStrapper.Reset();
-
- const string nameSpace = "Assembly.User";
-
- _classAttributes = new ClassAttributes("User")
- {
- Namespace = nameSpace,
- Properties = new List<Property>
- {
- new Property("System.Double", "Id"),
- new Property("System.String", "Name")
- }
- };
- _classNames = new[] { _classAttributes.FullName };
-
- _assemblyAttributes = new AssemblyAttributes(nameSpace);
- _classGenerator = new ClassFileGenerator();
- _assemblyGenerator = new AssemblyGenerator();
- }
-
- [TearDown]
- public void TearDown()
- {
- File.Delete(_classAttributes.FullName);
- File.Delete(_assemblyAttributes.FullName);
- }
-
- [Test]
- public void Should_generate_an_assembly()
- {
- _classGenerator.Create(_classAttributes);
- Assert.IsTrue(_assemblyGenerator.Compile(_classNames, _assemblyAttributes));
- Assert.IsTrue(File.Exists(_assemblyAttributes.FullName));
- }
-
- [Test]
- public void Should_generate_an_errorLog_if_it_cannot_compile_the_assembly()
- {
- _classAttributes.Properties.Add(new Property
- {
- Type = "Double"
- });
- _classGenerator.Create(_classAttributes);
-
- Assert.IsFalse(_assemblyGenerator.Compile(_classNames, _assemblyAttributes));
- Assert.IsTrue(File.Exists(TestData.LogFile));
- }
- }
- }
-}
View
125 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassFileGeneratorTests.cs
@@ -1,125 +0,0 @@
-using System.IO;
-
-using NUnit.Framework;
-
-using RunTimeCodeGenerator.ClassGeneration;
-
-namespace RunTimeCodeGenerator.Tests.ClassGeneration
-{
- public class ClassFileGeneratorTests
- {
- internal class FileComparer
- {
- public bool Compare(string file1, string file2)
- {
- using (FileStream fileStream1 = File.OpenRead(file1))
- {
- using (FileStream fileStream2 = File.OpenRead(file2))
- {
- if (fileStream1.Length != fileStream2.Length)
- {
- return false;
- }
- while (fileStream1.ReadByte() != fileStream2.ReadByte())
- {
- return false;
- }
- return true;
- }
- }
- }
- }
-
- [TestFixture]
- public class When_asked_to_generate_a_class_file
- {
- private ClassAttributes _classAttributes;
- private IClassGenerator _classGenerator;
- private Method _method;
-
- [SetUp]
- public void SetUp()
- {
- _classAttributes = new ClassAttributes("TestClass");
- _classAttributes.AddUsingNamespaces("System");
- _classAttributes.Namespace = "TestNamespace";
-
- _method = new Method
- {
- Name = "TestMethod",
- ReturnType = "string",
- AccessLevel = AccessLevel.Public
- };
- _method.Body.Add("string variable = \"Test\";");
- _method.Body.Add("Console.WriteLine(\"Hello\");");
- _method.Body.Add("return variable;");
- _classAttributes.Methods.Add(_method);
-
- _classGenerator = new ClassFileGenerator();
- }
-
- [TearDown]
- public void TearDown()
- {
- File.Delete(_classAttributes.FullName);
- }
-
- [Test]
- public void Should_create_a_class_file()
- {
- _classGenerator.Create(_classAttributes);
-
- string fileName = _classAttributes.FullName;
- Assert.IsTrue(File.Exists(fileName));
- Assert.IsTrue(new FileComparer().Compare(fileName, TestData.ClassWithMethods));
- }
-
- [Test]
- public void Should_create_a_class_file_with_method_parameters()
- {
- _method.Parameters.Add(new Parameter("string", "param1"));
- _method.Parameters.Add(new Parameter("int", "param2"));
-
- _classGenerator.Create(_classAttributes);
-
- string fileName = _classAttributes.FullName;
- Assert.IsTrue(File.Exists(fileName));
- Assert.IsTrue(new FileComparer().Compare(fileName, TestData.ClassWithMethodsWithParameters));
- }
- }
-
- [TestFixture]
- public class When_asked_to_generate_a_class_file_with_only_properties
- {
- private ClassAttributes _classAttributes;
- private IClassGenerator _classGenerator;
-
- [SetUp]
- public void SetUp()
- {
- _classAttributes = new ClassAttributes("TestClass");
- _classAttributes.AddUsingNamespaces("System");
- _classAttributes.Properties.Add(new Property("Double", "TestItem1"));
- _classAttributes.Properties.Add(new Property("string", "TestItem2"));
-
- _classGenerator = new ClassFileGenerator();
- }
-
- [TearDown]
- public void TearDown()
- {
- File.Delete(_classAttributes.FullName);
- }
-
- [Test]
- public void Should_create_a_class_file()
- {
- _classGenerator.Create(_classAttributes);
-
- string fileName = _classAttributes.FullName;
- Assert.IsTrue(File.Exists(fileName));
- Assert.IsTrue(new FileComparer().Compare(fileName, TestData.ClassWithProperties));
- }
- }
- }
-}
View
74 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassFileWriterTests.cs
@@ -1,74 +0,0 @@
-using System.IO;
-
-using NUnit.Framework;
-
-using RunTimeCodeGenerator.ClassGeneration;
-
-namespace RunTimeCodeGenerator.Tests.ClassGeneration
-{
- public class ClassFileWriterTests
- {
- public class FileWriterTestsBase
- {
- protected IClassFileWriter _fileWriter;
- protected const string FileName = "Test";
- protected const string Text = "Testing...";
-
- [SetUp]
- public void SetUp()
- {
- _fileWriter = new ClassFileWriter("Test");
- }
-
- [TearDown]
- public void TearDown()
- {
- File.Delete(FileName);
- }
- }
-
- [TestFixture]
- public class When_asked_to_create_a_file : FileWriterTestsBase
- {
- [Test]
- public void Should_create_a_file_with_the_right_access_rights_and_mode()
- {
- _fileWriter.Dispose();
- Assert.IsTrue(File.Exists(FileName));
- }
- }
-
- [TestFixture]
- public class When_given_a_string : FileWriterTestsBase
- {
- [Test]
- public void Should_write_the_string_in_the_file()
- {
- _fileWriter.Write(Text);
- _fileWriter.Dispose();
-
- Assert.IsTrue(File.ReadAllText(FileName).Contains(Text));
- }
- }
-
- [TestFixture]
- public class When_asked_to_close_the_file : FileWriterTestsBase
- {
- [Test]
- public void Should_dispose_the_handle_to_the_file()
- {
- _fileWriter.Write(Text);
- _fileWriter.Dispose();
-
- try
- {
- File.ReadAllText(FileName);
- }
- catch (IOException)
- {
- Assert.Fail("File is not closed properly");
- }
- }
- }
- }
-}
View
14 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassWithMethods.cs
@@ -1,14 +0,0 @@
-using System;
-
-namespace TestNamespace
-{
- public class TestClass
- {
- public string TestMethod()
- {
- string variable = "Test";
- Console.WriteLine("Hello");
- return variable;
- }
- }
-}
View
14 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassWithMethodsWithParameters.cs
@@ -1,14 +0,0 @@
-using System;
-
-namespace TestNamespace
-{
- public class TestClass
- {
- public string TestMethod(string param1,int param2)
- {
- string variable = "Test";
- Console.WriteLine("Hello");
- return variable;
- }
- }
-}
View
7 src/RunTimeCodeGenerator.Tests/ClassGeneration/ClassWithProperties.cs
@@ -1,7 +0,0 @@
-using System;
-
-public class TestClass
-{
- public Double TestItem1 { get; set; }
- public string TestItem2 { get; set; }
-}
View
32 src/RunTimeCodeGenerator.Tests/Logging/FileListenerTests.cs
@@ -1,32 +0,0 @@
-using System.IO;
-
-using NUnit.Framework;
-
-using RunTimeCodeGenerator.Logging;
-
-namespace RunTimeCodeGenerator.Tests.Logging
-{
- public class FileListenerTests
- {
- [TestFixture]
- public class When_asked_FileListener_to_log_a_message
- {
- [SetUp]
- public void SetUp()
- {
- File.Delete(TestData.LogFile);
- }
-
- [Test]
- public void Should_write_the_message_in_to_a_file()
- {
- const string message = "Application failed to launch";
- const string expectedMessage = "Error: " + message;
- FileListener fileListener = new FileListener(TestData.LogFile);
- fileListener.Writeline(MessageType.Error, message);
- Assert.IsTrue(File.Exists(TestData.LogFile));
- File.ReadAllText(TestData.LogFile).Equals(expectedMessage);
- }
- }
- }
-}
View
36 src/RunTimeCodeGenerator.Tests/Logging/LogTests.cs
@@ -1,36 +0,0 @@
-using NUnit.Framework;
-
-using RunTimeCodeGenerator.Logging;
-
-namespace RunTimeCodeGenerator.Tests.Logging
-{
- public class LogTests
- {
- public class Test
- {
- }
-
- [TestFixture]
- public class When_asked_for_Log
- {
- [SetUp]
- public void SetUp()
- {
- BootStrapper.Reset();
- }
-
- [Test]
- public void Should_return_Logger()
- {
- Assert.IsInstanceOfType(typeof(Logger), Log.For(typeof(Test)));
- }
-
- [Test]
- public void Should_return_logger_with_Console_and_FileListeners()
- {
- Assert.IsTrue(Log.For(typeof(Test)).Listeners.Exists(x => x.GetType() == typeof(ConsoleListener)));
- Assert.IsTrue(Log.For(typeof(Test)).Listeners.Exists(x => x.GetType() == typeof(FileListener)));
- }
- }
- }
-}
View
26 src/RunTimeCodeGenerator.Tests/Logging/LoggerTests.cs
@@ -1,26 +0,0 @@
-using NUnit.Framework;
-
-using RunTimeCodeGenerator.Logging;
-
-namespace RunTimeCodeGenerator.Tests.Logging
-{
- public class LoggerTests
- {
- [TestFixture]
- public class When_a_Logger_is_created
- {
- [Test]
- public void Should_include_consoleListener_by_default()
- {
- Assert.IsTrue(new Logger("Test").Listeners.Exists(x => x.GetType() == typeof(ConsoleListener)));
- }
-
- [Test]
- public void Should_set_the_SourceName()
- {
- const string sourceName = "Test";
- Assert.AreEqual(sourceName, new Logger(sourceName).SourceName);
- }
- }
- }
-}
View
36 src/RunTimeCodeGenerator.Tests/Properties/AssemblyInfo.cs
@@ -1,36 +0,0 @@
-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("RunTimeCodeGenerator.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("RunTimeCodeGenerator.Tests")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
-[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("43fcc327-6f74-4c34-b58e-38a76bd7a13f")]
-
-// 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 Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
View
90 src/RunTimeCodeGenerator.Tests/RunTimeCodeGenerator.Tests.csproj
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{AEBF09F8-7E7E-4436-BD01-AD74AB84B1C6}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>RunTimeCodeGenerator.Tests</RootNamespace>
- <AssemblyName>RunTimeCodeGenerator.Tests</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </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>
- </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.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="Rhino.Mocks, Version=3.5.0.1337, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Rhino.Mocks.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyGeneration\AssemblyGeneratorTests.cs" />
- <Compile Include="ClassGeneration\ClassFileGeneratorTests.cs" />
- <Compile Include="ClassGeneration\ClassFileWriterTests.cs" />
- <Compile Include="ClassGeneration\ClassWithMethodsWithParameters.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Compile>
- <Compile Include="Logging\FileListenerTests.cs" />
- <Compile Include="Logging\LoggerTests.cs" />
- <Compile Include="Logging\LogTests.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TestData.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\RunTimeCodeGenerator\RunTimeCodeGenerator.csproj">
- <Project>{641B6388-773E-48B1-B41C-DBD631512129}</Project>
- <Name>RunTimeCodeGenerator</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="ClassGeneration\ClassWithMethods.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="ClassGeneration\ClassWithProperties.cs">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </None>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\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>
View
11 src/RunTimeCodeGenerator.Tests/TestData.cs
@@ -1,11 +0,0 @@
-namespace RunTimeCodeGenerator.Tests
-{
- public class TestData
- {
- public static string Directory = "TestDirectory";
- public static string ClassWithProperties = "ClassGeneration\\ClassWithProperties.cs";
- public static string ClassWithMethods = "ClassGeneration\\ClassWithMethods.cs";
- public static string ClassWithMethodsWithParameters = "ClassGeneration\\ClassWithMethodsWithParameters.cs";
- public static string LogFile = "RunTimeCodeGeneratorLogs.log";
- }
-}
View
32 src/RunTimeCodeGenerator/AssemblyGeneration/AssemblyAttributes.cs
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace RunTimeCodeGenerator.AssemblyGeneration
-{
- public class AssemblyAttributes
- {
- public AssemblyAttributes(string name)
- {
- Name = name;
- }
-
- public string Name { get; set; }
- public string FullName
- {
- get { return String.Format("{0}.dll", Name); }
- }
-
- public List<string> References = new List<string>();
- public List<string> Resources = new List<string>();
-
- public void AddReference(string reference)
- {
- References.Add(reference);
- }
-
- public void AddResource(string resource)
- {
- References.Add(resource);
- }
- }
-}
View
47 src/RunTimeCodeGenerator/AssemblyGeneration/AssemblyGenerator.cs
@@ -1,47 +0,0 @@
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-
-using Microsoft.CSharp;
-
-using RunTimeCodeGenerator.Logging;
-
-namespace RunTimeCodeGenerator.AssemblyGeneration
-{
- public class AssemblyGenerator : IAssemblyGenerator
- {
- public bool Compile(string[] classNames, AssemblyAttributes assemblyAttributes)
- {
- CSharpCodeProvider codeProvider = new CSharpCodeProvider(new Dictionary<string, string>
- {
- { "CompilerVersion", "v3.5" }
- });
-
- CompilerParameters parameters = new CompilerParameters
- {
- OutputAssembly = assemblyAttributes.FullName
- };
-
- parameters.ReferencedAssemblies.AddRange(assemblyAttributes.References.ToArray());
- parameters.EmbeddedResources.AddRange(assemblyAttributes.Resources.ToArray());
-
- CompilerResults compilerResults = codeProvider.CompileAssemblyFromFile(parameters, classNames);
-
- GenerateErrorReport(compilerResults.Errors);
-
- return compilerResults.Errors.Count == 0;
- }
-
- private static void GenerateErrorReport(CompilerErrorCollection errorsCollection)
- {
- if (errorsCollection.Count == 0)
- {
- return;
- }
-
- foreach (CompilerError error in errorsCollection)
- {
- Log.For(typeof(AssemblyGenerator)).LogError("{0}: {1}", error.FileName, error.ErrorText);
- }
- }
- }
-}
View
7 src/RunTimeCodeGenerator/AssemblyGeneration/IAssemblyGenerator.cs
@@ -1,7 +0,0 @@
-namespace RunTimeCodeGenerator.AssemblyGeneration
-{
- public interface IAssemblyGenerator
- {
- bool Compile(string[] classNames, AssemblyAttributes assemblyAttributes);
- }
-}
View
27 src/RunTimeCodeGenerator/BootStrapper.cs
@@ -1,27 +0,0 @@
-using StructureMap;
-
-namespace RunTimeCodeGenerator
-{
- public class BootStrapper
- {
- private static bool _initialized;
-
- public static void Initialize()
- {
- ObjectFactory.Initialize(x => x.AddRegistry(new RunTimeCodeGeneratorRegistry()));
- }
-
- public static void Reset()
- {
- if (_initialized)
- {
- ObjectFactory.ResetDefaults();
- }
- else
- {
- Initialize();
- _initialized = true;
- }
- }
- }
-}
View
16 src/RunTimeCodeGenerator/ClassGeneration/AccessLevel.cs
@@ -1,16 +0,0 @@
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class AccessLevel
- {
- public static readonly AccessLevel Private = new AccessLevel("private");
- public static readonly AccessLevel Protected = new AccessLevel("protected");
- public static readonly AccessLevel Public = new AccessLevel("public");
-
- private AccessLevel(string value)
- {
- Value = value;
- }
-
- public string Value { get; set; }
- }
-}
View
41 src/RunTimeCodeGenerator/ClassGeneration/ClassAttributes.cs
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class ClassAttributes
- {
- public ClassAttributes(string name)
- {
- Name = name;
- }
-
- public string Namespace { get; set; }
- public string Name { get; set; }
- public string FullName
- {
- get { return String.Format("{0}.{1}.cs", Namespace, Name); }
- }
-
- public List<string> UsingNamespaces = new List<string>();
-
- public void AddUsingNamespaces(string usingNamespace)
- {
- UsingNamespaces.Add(usingNamespace);
- }
-
- public List<Property> Properties = new List<Property>();
-
- public void AddProperty(Property property)
- {
- Properties.Add(property);
- }
-
- public List<Method> Methods = new List<Method>();
-
- public void AddMethod(Method method)
- {
- Methods.Add(method);
- }
- }
-}
View
121 src/RunTimeCodeGenerator/ClassGeneration/ClassFileGenerator.cs
@@ -1,121 +0,0 @@
-using System;
-using System.Linq;
-
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class ClassFileGenerator : IClassGenerator
- {
- public void Create(ClassAttributes classAttributes)
- {
- using (IClassFileWriter classFileWriter = new ClassFileWriter(classAttributes.FullName))
- {
- foreach (var usingNamespace in classAttributes.UsingNamespaces)
- {
- AddUsing(classFileWriter, usingNamespace);
- }
-
- classFileWriter.Write();
-
- StartNamespace(classFileWriter, classAttributes.Namespace);
- {
- StartClass(classFileWriter, classAttributes.Name);
- {
- foreach (var property in classAttributes.Properties)
- {
- AddProperty(classFileWriter, property);
- }
-
- foreach (var method in classAttributes.Methods)
- {
- StartMethod(classFileWriter, method);
- {
- AddMethod(classFileWriter, method);
- }
- classFileWriter.CloseBlock();
- }
- }
- classFileWriter.CloseBlock();
- }
- CloseNamespace(classFileWriter, classAttributes.Namespace);
- }
- }
-
- private static void AddUsing(IClassFileWriter classFileWriter, string usingNamespace)
- {
- classFileWriter.Write(String.Format("using {0};", usingNamespace));
- }
-
- private static void StartNamespace(IClassFileWriter classFileWriter, string classNamespace)
- {
- if (String.IsNullOrEmpty(classNamespace))
- {
- return;
- }
- classFileWriter.Write(String.Format("namespace {0}", classNamespace));
- classFileWriter.StartBlock();
- }
-
- private static void CloseNamespace(IClassFileWriter classFileWriter, string classNamespace)
- {
- if (String.IsNullOrEmpty(classNamespace))
- {
- return;
- }
- classFileWriter.CloseBlock();
- }
-
- private static void StartClass(IClassFileWriter classFileWriter, string className)
- {
- classFileWriter.Write(String.Format("{0} class {1}", AccessLevel.Public.Value, className));
- classFileWriter.StartBlock();
- }
-
- private static void StartMethod(IClassFileWriter classFileWriter, Method method)
- {
- var parameters = String.Join(",", method.Parameters.Select(x => x.ToString()).ToArray());
- classFileWriter.Write(String.Format("{0} {1} {2}({3})", method.AccessLevel.Value, method.ReturnType, method.Name, parameters));
-
- classFileWriter.StartBlock();
- }
-
- private static void AddProperty(IClassFileWriter classFileWriter, Property property)
- {
- classFileWriter.Write(String.Format("{0} {1} {2} {{ get; set; }}", AccessLevel.Public.Value, property.Type, property.Name));
- }
-
- private static void AddMethod(IClassFileWriter classFileWriter, Method method)
- {
- foreach (var line in method.Body)
- {
- string formattedLine = line;
- bool endBlock = line.StartsWith("}");
- bool startBlock = line.EndsWith("{");
-
- if (endBlock)
- {
- if (formattedLine.Length > 1)
- {
- formattedLine = formattedLine.Substring(1).Trim();
- }
- classFileWriter.CloseBlock();
- }
- if (startBlock)
- {
- if (formattedLine.Length > 1)
- {
- formattedLine = formattedLine.Substring(0, formattedLine.Length - 1);
- }
- }
-
- if (line.Length > 1)
- {
- classFileWriter.Write(formattedLine);
- }
- if (startBlock && formattedLine != "{")
- {
- classFileWriter.StartBlock();
- }
- }
- }
- }
-}
View
52 src/RunTimeCodeGenerator/ClassGeneration/ClassFileWriter.cs
@@ -1,52 +0,0 @@
-using System.IO;
-
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class ClassFileWriter : IClassFileWriter
- {
- private readonly FileStream _fileStream;
- private readonly StreamWriter _streamWriter;
- private int _indent;
- private bool _isDisposed;
-
- public ClassFileWriter(string className)
- {
- _fileStream = new FileStream(className, FileMode.Create, FileAccess.Write);
- _streamWriter = new StreamWriter(_fileStream);
- _indent = 0;
- }
-
- public void StartBlock()
- {
- Write("{");
- _indent++;
- }
-
- public void CloseBlock()
- {
- _indent--;
- Write("}");
- }
-
- public void Write()
- {
- _streamWriter.WriteLine();
- }
-
- public void Write(string value)
- {
- _streamWriter.WriteLine("".PadLeft(_indent, '\t') + value);
- }
-
- public void Dispose()
- {
- if (_isDisposed)
- {
- return;
- }
- _streamWriter.Close();
- _fileStream.Close();
- _isDisposed = true;
- }
- }
-}
View
10 src/RunTimeCodeGenerator/ClassGeneration/ClassGenerator.cs
@@ -1,10 +0,0 @@
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class ClassGenerator
- {
- public bool Create(ClassAttributes classAttributes)
- {
- return true;
- }
- }
-}
View
12 src/RunTimeCodeGenerator/ClassGeneration/IClassFileWriter.cs
@@ -1,12 +0,0 @@
-using System;
-
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public interface IClassFileWriter : IDisposable
- {
- void StartBlock();
- void CloseBlock();
- void Write(string value);
- void Write();
- }
-}
View
7 src/RunTimeCodeGenerator/ClassGeneration/IClassGenerator.cs
@@ -1,7 +0,0 @@
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public interface IClassGenerator
- {
- void Create(ClassAttributes classAttributes);
- }
-}
View
24 src/RunTimeCodeGenerator/ClassGeneration/Method.cs
@@ -1,24 +0,0 @@
-using System.Collections.Generic;
-
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class Method
- {
- public Method()
- {
- Body = new List<string>();
- Parameters = new List<Parameter>();
- }
-
- public AccessLevel AccessLevel { get; set; }
- public List<string> Body { get; set; }
- public string Name { get; set; }
- public List<Parameter> Parameters { get; set; }
- public string ReturnType { get; set; }
-
- public void AddBody(string line)
- {
- Body.Add(line);
- }
- }
-}
View
25 src/RunTimeCodeGenerator/ClassGeneration/Parameter.cs
@@ -1,25 +0,0 @@
-using System;
-
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class Parameter
- {
- public Parameter(string type, string name)
- {
- Type = type;
- Name = name;
- }
-
- public Parameter()
- {
- }
-
- public string Name { get; set; }
- public string Type { get; set; }
-
- public override string ToString()
- {
- return String.Format("{0} {1}", Type, Name);
- }
- }
-}
View
18 src/RunTimeCodeGenerator/ClassGeneration/Property.cs
@@ -1,18 +0,0 @@
-namespace RunTimeCodeGenerator.ClassGeneration
-{
- public class Property
- {
- public Property()
- {
- }
-
- public Property(string type, string name)
- {
- Type = type;
- Name = name;
- }
-
- public string Type { get; set; }
- public string Name { get; set; }
- }
-}
View
7 src/RunTimeCodeGenerator/DefaultSettings.cs
@@ -1,7 +0,0 @@
-namespace RunTimeCodeGenerator
-{
- public class DefaultSettings
- {
- public static string LogFile = "RunTimeCodeGeneratorLogs.log";
- }
-}
View
12 src/RunTimeCodeGenerator/Logging/ConsoleListener.cs
@@ -1,12 +0,0 @@
-using System;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public class ConsoleListener : IListener
- {
- public void Writeline(MessageType messageType, string message)
- {
- Console.WriteLine("{0}: {1}", messageType.Value, message);
- }
- }
-}
View
23 src/RunTimeCodeGenerator/Logging/FileListener.cs
@@ -1,23 +0,0 @@
-using System.IO;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public class FileListener : IListener
- {
- private readonly string _logFile;
-
- public FileListener(string logFile)
- {
- _logFile = logFile;
- }
-
- public void Writeline(MessageType messageType, string message)
- {
- using (var fileStream = new FileStream(_logFile, FileMode.Append, FileAccess.Write))
- using (var writer = new StreamWriter(fileStream))
- {
- writer.Write("{0}: {1}", messageType.Value, message);
- }
- }
- }
-}
View
7 src/RunTimeCodeGenerator/Logging/IListener.cs
@@ -1,7 +0,0 @@
-namespace RunTimeCodeGenerator.Logging
-{
- public interface IListener
- {
- void Writeline(MessageType messageType, string message);
- }
-}
View
9 src/RunTimeCodeGenerator/Logging/ILogFactory.cs
@@ -1,9 +0,0 @@
-using System;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public interface ILogFactory
- {
- ILogger Create(Type type);
- }
-}
View
17 src/RunTimeCodeGenerator/Logging/ILogger.cs
@@ -1,17 +0,0 @@
-using System.Collections.Generic;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public interface ILogger
- {
- List<IListener> Listeners { get; }
-
- string SourceName { get; }
-
- void LogInformation(string format, params object[] args);
-
- void LogWarning(string format, params object[] args);
-
- void LogError(string format, params object[] args);
- }
-}
View
15 src/RunTimeCodeGenerator/Logging/Log.cs
@@ -1,15 +0,0 @@
-using System;
-
-using StructureMap;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public class Log
- {
- public static ILogger For(Type type)
- {
- return ObjectFactory.GetInstance<ILogFactory>()
- .Create(type);
- }
- }
-}
View
15 src/RunTimeCodeGenerator/Logging/LogFactory.cs
@@ -1,15 +0,0 @@
-using System;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public class LogFactory : ILogFactory
- {
- public ILogger Create(Type type)
- {
- // All types get both console and file logging
- Logger logger = new Logger(type.Name);
- logger.Listeners.Add(new FileListener(DefaultSettings.LogFile));
- return logger;
- }
- }
-}
View
50 src/RunTimeCodeGenerator/Logging/Logger.cs
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace RunTimeCodeGenerator.Logging
-{
- public class Logger : ILogger
- {
- private readonly List<IListener> _listeners;
-
- public Logger(string sourceName)
- {
- SourceName = sourceName;
-
- _listeners = new List<IListener>
- {
- new ConsoleListener()
- };
- }
-
- public List<IListener> Listeners
- {
- get { return _listeners; }
- }
-
- public string SourceName { get; private set; }
-
- public void LogInformation(string format, params object[] args)
- {
- Log(SourceName, MessageType.Information, format, args);
- }
-
- public void LogWarning(string format, params object[] args)
- {
- Log(SourceName, MessageType.Warning, format, args);
- }
-
- public void LogError(string format, params object[] args)
- {
- Log(SourceName, MessageType.Error, format, args);
- }
-
- private void Log(string sourceName, MessageType messageType, string format, object[] args)
- {
- foreach (IListener listener in _listeners)
- {
- listener.Writeline(messageType, String.Format("[{0}] {1}", sourceName, String.Format(format, args)));
- }
- }
- }
-}
View
16 src/RunTimeCodeGenerator/Logging/MessageType.cs
@@ -1,16 +0,0 @@
-namespace RunTimeCodeGenerator.Logging
-{
- public class MessageType
- {
- public static readonly MessageType Information = new MessageType("Information");
- public static readonly MessageType Warning = new MessageType("Warning");
- public static readonly MessageType Error = new MessageType("Error");
-
- public string Value { get; set; }
-
- private MessageType(string value)
- {
- Value = value;
- }
- }
-}
View
36 src/RunTimeCodeGenerator/Properties/AssemblyInfo.cs
@@ -1,36 +0,0 @@
-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("RunTimeCodeGenerator")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("RunTimeCodeGenerator")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
-[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("c0a1cba8-25e8-425d-89f7-031117213110")]
-
-// 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 Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
View
89 src/RunTimeCodeGenerator/RunTimeCodeGenerator.csproj
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{641B6388-773E-48B1-B41C-DBD631512129}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>RunTimeCodeGenerator</RootNamespace>
- <AssemblyName>RunTimeCodeGenerator</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </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>
- </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="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\StructureMap.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Drawing" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyGeneration\AssemblyGenerator.cs" />
- <Compile Include="AssemblyGeneration\AssemblyAttributes.cs" />
- <Compile Include="AssemblyGeneration\IAssemblyGenerator.cs" />
- <Compile Include="BootStrapper.cs" />
- <Compile Include="ClassGeneration\AccessLevel.cs" />
- <Compile Include="ClassGeneration\ClassFileGenerator.cs" />
- <Compile Include="ClassGeneration\ClassFileWriter.cs" />
- <Compile Include="ClassGeneration\ClassGenerator.cs" />
- <Compile Include="ClassGeneration\ClassAttributes.cs" />
- <Compile Include="ClassGeneration\IClassFileWriter.cs" />
- <Compile Include="ClassGeneration\IClassGenerator.cs" />
- <Compile Include="ClassGeneration\Method.cs" />
- <Compile Include="ClassGeneration\Parameter.cs" />
- <Compile Include="ClassGeneration\Property.cs" />
- <Compile Include="DefaultSettings.cs" />
- <Compile Include="Logging\ConsoleListener.cs" />
- <Compile Include="Logging\FileListener.cs" />
- <Compile Include="Logging\IListener.cs" />
- <Compile Include="Logging\ILogFactory.cs" />
- <Compile Include="Logging\ILogger.cs" />
- <Compile Include="Logging\Log.cs" />
- <Compile Include="Logging\Logger.cs" />
- <Compile Include="Logging\MessageType.cs" />
- <Compile Include="Logging\LogFactory.cs" />
- <Compile Include="RunTimeCodeGeneratorRegistry.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\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>
View
20 src/RunTimeCodeGenerator/RunTimeCodeGeneratorRegistry.cs
@@ -1,20 +0,0 @@
-using RunTimeCodeGenerator.ClassGeneration;
-
-using StructureMap.Configuration.DSL;
-
-namespace RunTimeCodeGenerator
-{
- public class RunTimeCodeGeneratorRegistry : Registry
- {
- public RunTimeCodeGeneratorRegistry()
- {
- ForRequestedType<IClassGenerator>()
- .TheDefaultIsConcreteType<ClassFileGenerator>();
- Scan(s =>
- {
- s.AssemblyContainingType<RunTimeCodeGeneratorRegistry>();
- s.WithDefaultConventions();
- });
- }
- }
-}
View
2  src/Samples.Tests/ReadWriteExistingExcelFileTests.cs
@@ -43,7 +43,7 @@ public void ReadFromExcel()
}
}
- [Test]
+ [Test, Explicit]
public void WriteToExcel()
{
ServiceLocator.Current.GetInstance<IFileConfiguration>().FileName = DemoWorkSheetFile;
View
4 src/Samples.Tests/Samples.Tests.csproj
@@ -37,11 +37,11 @@
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\lib\ServiceLocator\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\nunit.framework.dll</HintPath>
+ <HintPath>..\..\lib\NUnit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
Please sign in to comment.
Something went wrong with that request. Please try again.