2) Gave UnitTests internal access to DocX.dll
DocX AssemblyInfo.cs
[assembly: InternalsVisibleTo("UnitTests")]
3) Updated target framework to .NET 4.0.
4) Fixed bug with InsertText() Formatting object was set to null by default, should have been new Formatting()
master
| <AppDesignerFolder>Properties</AppDesignerFolder> | <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
| <RootNamespace>Novacode</RootNamespace> | <RootNamespace>Novacode</RootNamespace> | ||||
| <AssemblyName>DocX</AssemblyName> | <AssemblyName>DocX</AssemblyName> | ||||
| <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | <FileAlignment>512</FileAlignment> | ||||
| <SccProjectName>SAK</SccProjectName> | <SccProjectName>SAK</SccProjectName> | ||||
| <SccLocalPath>SAK</SccLocalPath> | <SccLocalPath>SAK</SccLocalPath> | ||||
| <StartupObject> | <StartupObject> | ||||
| </StartupObject> | </StartupObject> | ||||
| <SignAssembly>true</SignAssembly> | <SignAssembly>true</SignAssembly> | ||||
| <AssemblyOriginatorKeyFile> | |||||
| </AssemblyOriginatorKeyFile> | |||||
| <AssemblyOriginatorKeyFile>StrongNameKey.pfx</AssemblyOriginatorKeyFile> | |||||
| <FileUpgradeFlags> | <FileUpgradeFlags> | ||||
| </FileUpgradeFlags> | </FileUpgradeFlags> | ||||
| <OldToolsVersion>3.5</OldToolsVersion> | <OldToolsVersion>3.5</OldToolsVersion> | ||||
| <IsWebBootstrapper>false</IsWebBootstrapper> | <IsWebBootstrapper>false</IsWebBootstrapper> | ||||
| <UseApplicationTrust>false</UseApplicationTrust> | <UseApplicationTrust>false</UseApplicationTrust> | ||||
| <BootstrapperEnabled>true</BootstrapperEnabled> | <BootstrapperEnabled>true</BootstrapperEnabled> | ||||
| <TargetFrameworkProfile /> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||||
| <DebugSymbols>true</DebugSymbols> | <DebugSymbols>true</DebugSymbols> |
| /// </example> | /// </example> | ||||
| public Paragraph InsertParagraphBeforeSelf(string text) | public Paragraph InsertParagraphBeforeSelf(string text) | ||||
| { | { | ||||
| return InsertParagraphBeforeSelf(text, false, new Formatting()); | |||||
| return InsertParagraphBeforeSelf(text, false, null); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| /// <param name="formatting">The text formatting.</param> | /// <param name="formatting">The text formatting.</param> | ||||
| public void InsertText(string value, bool trackChanges = false, Formatting formatting = null) | public void InsertText(string value, bool trackChanges = false, Formatting formatting = null) | ||||
| { | { | ||||
| // Default values for optional parameters must be compile time constants. | |||||
| // Would have like to write 'public void InsertText(string value, bool trackChanges = false, Formatting formatting = new Formatting()) | |||||
| if (formatting == null) formatting = new Formatting(); | |||||
| List<XElement> newRuns = HelperFunctions.FormatInput(value, formatting.Xml); | List<XElement> newRuns = HelperFunctions.FormatInput(value, formatting.Xml); | ||||
| Xml.Add(newRuns); | Xml.Add(newRuns); | ||||
| /// <param name="formatting">The text formatting.</param> | /// <param name="formatting">The text formatting.</param> | ||||
| public void InsertText(int index, string value, bool trackChanges=false, Formatting formatting = null) | public void InsertText(int index, string value, bool trackChanges=false, Formatting formatting = null) | ||||
| { | { | ||||
| #region Default values for optional parameters must be compile time constants. | |||||
| // Would like to have written 'Formatting formatting = new Formatting()) | |||||
| if (formatting == null) formatting = new Formatting(); | |||||
| #endregion | |||||
| // Timestamp to mark the start of insert | // Timestamp to mark the start of insert | ||||
| DateTime now = DateTime.Now; | DateTime now = DateTime.Now; | ||||
| DateTime insert_datetime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, DateTimeKind.Utc); | DateTime insert_datetime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, DateTimeKind.Utc); |
| [assembly: AssemblyCulture("")] | [assembly: AssemblyCulture("")] | ||||
| // Allow the UnitTests to get at internal stuff. | // Allow the UnitTests to get at internal stuff. | ||||
| [assembly: InternalsVisibleTo("UnitTests")] | |||||
| [assembly: InternalsVisibleTo("UnitTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001008f789f4c5e510820397a319f4470c971513778e65ad102a225ed5b204aef1c6750ba5086268afe54fc515e005447be038d89fdfa5f55935f83e0916a229956b36f0eabf7ea9b2ee2e216b9e63e40a715833a2e5c9c6944de97231dd792ebdc3132cef5c6e0d7160383d7a44ae39933cfaee0aa6ae9fe1175630f443bfce259b2")] | |||||
| // Setting ComVisible to false makes the types in this assembly not visible | // 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 | // to COM components. If you need to access a type in this assembly from |
| <ErrorReport>prompt</ErrorReport> | <ErrorReport>prompt</ErrorReport> | ||||
| <WarningLevel>4</WarningLevel> | <WarningLevel>4</WarningLevel> | ||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup> | |||||
| <SignAssembly>true</SignAssembly> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <AssemblyOriginatorKeyFile>StrongNameKey.pfx</AssemblyOriginatorKeyFile> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||||
| <Reference Include="System" /> | <Reference Include="System" /> | ||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
| <Compile Include="UnitTest1.cs" /> | <Compile Include="UnitTest1.cs" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\DocX\DocX.csproj"> | |||||
| <Project>{E863D072-AA8B-4108-B5F1-785241B37F67}</Project> | |||||
| <Name>DocX</Name> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <None Include="documents\Images.docx" /> | <None Include="documents\Images.docx" /> | ||||
| <None Include="documents\Paragraphs.docx" /> | <None Include="documents\Paragraphs.docx" /> | ||||
| <None Include="documents\Tables.docx" /> | <None Include="documents\Tables.docx" /> | ||||
| <None Include="documents\Template.dotx" /> | <None Include="documents\Template.dotx" /> | ||||
| <None Include="StrongNameKey.pfx" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\DocX\DocX.csproj"> | |||||
| <Project>{E863D072-AA8B-4108-B5F1-785241B37F67}</Project> | |||||
| <Name>DocX</Name> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | </ItemGroup> | ||||
| <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |