Update Nuget test to version 6.0.0

* Use new version of packages
* Switch solution to use Visual Studio 2015
* Removed Visual Studio 2012/2013 cruft from csproj file.
* Re-sync test files with the core test.
* Fix up some tests that access internal variables that can be accessed
  using public properties.
This commit is contained in:
Christopher Warrington 2017-06-29 20:43:28 -07:00
Родитель 2435544269
Коммит 82e7dad616
5 изменённых файлов: 45 добавлений и 58 удалений

Просмотреть файл

@ -1,31 +0,0 @@
namespace Bond.Internal.Reflection
{
using System;
using System.Reflection;
/// <summary>
/// The minimal set of reflection methods needed to keep the NuGet tests working without having
/// access to the Bond.Reflection internals.
/// </summary>
// TODO: make the internals of Bond.Reflection visible to this assembly, which should always be
// signed with the bond.snk in the repository. I.e., don't condition this assembly on
// DELAY_SIGN
static class NugetTestHelpers
{
public static bool IsGenericType(this Type type)
{
return type.GetTypeInfo().IsGenericType;
}
public static PropertyInfo GetDeclaredProperty(this Type type, string name)
{
return type.GetTypeInfo().GetDeclaredProperty(name);
}
public static PropertyInfo GetDeclaredProperty(this Type type, string name, Type returnType)
{
var property = type.GetDeclaredProperty(name);
return (property != null && property.PropertyType == returnType) ? property : null;
}
}
}

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.props" Condition="Exists('..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.props')" />
<Import Project="..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.props" Condition="Exists('..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -12,12 +12,12 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\build\internal\bond.snk</AssemblyOriginatorKeyFile>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -37,48 +37,51 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Bond, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.5.3.1\lib\net45\Bond.dll</HintPath>
<Reference Include="Bond, Version=6.0.0.100, Culture=neutral, PublicKeyToken=87e9ead25a117286, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.6.0.0\lib\net45\Bond.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Bond.Attributes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.5.3.1\lib\net45\Bond.Attributes.dll</HintPath>
<Reference Include="Bond.Attributes, Version=6.0.0.100, Culture=neutral, PublicKeyToken=87e9ead25a117286, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.6.0.0\lib\net45\Bond.Attributes.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Bond.IO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.5.3.1\lib\net45\Bond.IO.dll</HintPath>
<Reference Include="Bond.IO, Version=6.0.0.100, Culture=neutral, PublicKeyToken=87e9ead25a117286, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.6.0.0\lib\net45\Bond.IO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Bond.JSON, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Runtime.CSharp.5.3.1\lib\net45\Bond.JSON.dll</HintPath>
<Reference Include="Bond.JSON, Version=6.0.0.100, Culture=neutral, PublicKeyToken=87e9ead25a117286, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Runtime.CSharp.6.0.0\lib\net45\Bond.JSON.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Bond.Reflection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.5.3.1\lib\net45\Bond.Reflection.dll</HintPath>
<Reference Include="Bond.Reflection, Version=6.0.0.100, Culture=neutral, PublicKeyToken=87e9ead25a117286, processorArchitecture=MSIL">
<HintPath>..\packages\Bond.Core.CSharp.6.0.0\lib\net45\Bond.Reflection.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
<ItemGroup>
<BondImportDirectory Include="..\test\core\import dir with spaces\" />
</ItemGroup>
<ItemGroup>
<Compile Include="NuGetTestReflection.cs" />
<Compile Include="..\test\core\AttributesTests.cs" />
<Compile Include="..\test\core\BondClass.cs" />
<Compile Include="..\test\core\BondedTests.cs" />
<Compile Include="..\test\core\CloningTests.cs" />
<Compile Include="..\test\core\CustomBondedTests.cs" />
<Compile Include="..\test\core\DeserializerControlsTests.cs" />
<Compile Include="..\test\core\EnumString.cs" />
<Compile Include="..\test\core\Equal.cs" />
<Compile Include="..\test\core\GenericsTests.cs" />
<Compile Include="..\test\core\GuidConversionTests.cs" />
<Compile Include="..\test\core\InterfaceTests.cs" />
<Compile Include="..\test\core\JsonParsingTests.cs" />
<Compile Include="..\test\core\JsonSerializationTests.cs" />
<Compile Include="..\test\core\MetaInitializationTests.cs" />
<Compile Include="..\test\core\Partial.cs" />
<Compile Include="..\test\core\Properties\AssemblyInfo.cs" />
@ -90,7 +93,8 @@
<Compile Include="..\test\core\Structs.cs" />
<Compile Include="..\test\core\TypeAliasTests.cs" />
<Compile Include="..\test\core\Util.cs" />
<Compile Include="..\test\core\XmlTests.cs" />
<Compile Include="..\test\core\XmlParsingTests.cs" />
<Compile Include="..\test\core\XmlSerializationTests.cs" />
<BondCodegen Include="..\test\core\Aliases.bond">
<Options>--using="Lazy=Lazy&lt;{0}&gt;" --using="CustomList=UnitTest.Aliases.SomeCustomList&lt;{0}&gt;" --using="OrderedSet=SortedSet&lt;{0}&gt;" --using="Decimal=decimal" --using="EnumString=Alias.EnumString&lt;{0}&gt;" --using="Array={0}[]"</Options>
</BondCodegen>
@ -137,8 +141,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.props'))" />
<Error Condition="!Exists('..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.targets'))" />
<Error Condition="!Exists('..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.props'))" />
<Error Condition="!Exists('..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.targets'))" />
</Target>
<Import Project="..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.targets" Condition="Exists('..\packages\Bond.CSharp.5.3.1\build\Bond.CSharp.targets')" />
<Import Project="..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.targets" Condition="Exists('..\packages\Bond.CSharp.6.0.0\build\Bond.CSharp.targets')" />
</Project>

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bond.csharp.test", "bond.csharp.test.csproj", "{0095FD14-722C-4D48-8930-5DCCF5A6DAA2}"
EndProject

Просмотреть файл

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Bond.Core.CSharp" version="5.3.1" targetFramework="net45" />
<package id="Bond.CSharp" version="5.3.1" targetFramework="net45" />
<package id="Bond.Runtime.CSharp" version="5.3.1" targetFramework="net45" />
<package id="Bond.Core.CSharp" version="6.0.0" targetFramework="net45" />
<package id="Bond.CSharp" version="6.0.0" targetFramework="net45" />
<package id="Bond.Runtime.CSharp" version="6.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable-net45+wp80+win8+wpa81" />
<package id="NUnit" version="2.6.4" targetFramework="portable-net45+wp80+win" />
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />

Просмотреть файл

@ -133,7 +133,14 @@
var writer = new SimpleBinaryWriter<OutputBuffer>(output);
Serialize.To(writer, obj);
var input = new InputStream(new MemoryStream(output.buffer));
var input =
new InputStream(
new MemoryStream(
output.Data.Array,
output.Data.Offset,
output.Data.Count,
writable: false,
publiclyVisible: true));
var reader = new SimpleBinaryReader<InputStream>(input);
T obj2 = Deserialize<T>.From(reader);
@ -146,7 +153,14 @@
var writer = new CompactBinaryWriter<OutputBuffer>(output);
Serialize.To(writer, obj);
var input = new InputStream(new MemoryStream(output.buffer));
var input =
new InputStream(
new MemoryStream(
output.Data.Array,
output.Data.Offset,
output.Data.Count,
writable: false,
publiclyVisible: true));
var reader = new CompactBinaryReader<InputStream>(input);
T obj2 = new Deserializer<CompactBinaryReader<InputStream>>(typeof(T)).Deserialize<T>(reader);