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
| @@ -10,7 +10,7 @@ | |||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||
| <RootNamespace>Novacode</RootNamespace> | |||
| <AssemblyName>DocX</AssemblyName> | |||
| <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | |||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <SccProjectName>SAK</SccProjectName> | |||
| <SccLocalPath>SAK</SccLocalPath> | |||
| @@ -19,8 +19,7 @@ | |||
| <StartupObject> | |||
| </StartupObject> | |||
| <SignAssembly>true</SignAssembly> | |||
| <AssemblyOriginatorKeyFile> | |||
| </AssemblyOriginatorKeyFile> | |||
| <AssemblyOriginatorKeyFile>StrongNameKey.pfx</AssemblyOriginatorKeyFile> | |||
| <FileUpgradeFlags> | |||
| </FileUpgradeFlags> | |||
| <OldToolsVersion>3.5</OldToolsVersion> | |||
| @@ -40,6 +39,7 @@ | |||
| <IsWebBootstrapper>false</IsWebBootstrapper> | |||
| <UseApplicationTrust>false</UseApplicationTrust> | |||
| <BootstrapperEnabled>true</BootstrapperEnabled> | |||
| <TargetFrameworkProfile /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| @@ -721,7 +721,7 @@ namespace Novacode | |||
| /// </example> | |||
| public Paragraph InsertParagraphBeforeSelf(string text) | |||
| { | |||
| return InsertParagraphBeforeSelf(text, false, new Formatting()); | |||
| return InsertParagraphBeforeSelf(text, false, null); | |||
| } | |||
| /// <summary> | |||
| @@ -1584,6 +1584,10 @@ namespace Novacode | |||
| /// <param name="formatting">The text formatting.</param> | |||
| 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); | |||
| Xml.Add(newRuns); | |||
| @@ -1648,6 +1652,11 @@ namespace Novacode | |||
| /// <param name="formatting">The text formatting.</param> | |||
| 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 | |||
| DateTime now = DateTime.Now; | |||
| DateTime insert_datetime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, DateTimeKind.Utc); | |||
| @@ -15,7 +15,7 @@ using System.Runtime.InteropServices; | |||
| [assembly: AssemblyCulture("")] | |||
| // 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 | |||
| // to COM components. If you need to access a type in this assembly from | |||
| @@ -36,6 +36,12 @@ | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <PropertyGroup> | |||
| <SignAssembly>true</SignAssembly> | |||
| </PropertyGroup> | |||
| <PropertyGroup> | |||
| <AssemblyOriginatorKeyFile>StrongNameKey.pfx</AssemblyOriginatorKeyFile> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | |||
| <Reference Include="System" /> | |||
| @@ -59,17 +65,18 @@ | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| <Compile Include="UnitTest1.cs" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\DocX\DocX.csproj"> | |||
| <Project>{E863D072-AA8B-4108-B5F1-785241B37F67}</Project> | |||
| <Name>DocX</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="documents\Images.docx" /> | |||
| <None Include="documents\Paragraphs.docx" /> | |||
| <None Include="documents\Tables.docx" /> | |||
| <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> | |||
| <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | |||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||