Skip to content

Commit ed451b8

Browse files
authored
Merge pull request #275 from msgpack/fix/stabilize-tests
2 parents defef75 + abca50f commit ed451b8

14 files changed

+71
-27
lines changed

appveyor-debug35.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: '{branch}-{build}'
2+
image: Visual Studio 2017
3+
skip_tags: true
4+
configuration: Debug
5+
assembly_info:
6+
patch: true
7+
file: '**\*AssemblyInfo.cs'
8+
assembly_version: $(AssemblyBaseVersion).0
9+
assembly_file_version: $(AssemblyBaseVersion).{build}
10+
assembly_informational_version: $(PackageVersion)
11+
environment:
12+
XamarinMSBuildExtensionsPath: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild
13+
install:
14+
- cmd: >-
15+
cd .\build
16+
- ps: >-
17+
./SetBuildEnv.ps1
18+
19+
cd ..
20+
build_script:
21+
- ps: >-
22+
Write-Host "Configuration=${env:CONFIGURATION}"
23+
24+
cd ./build
25+
26+
./Build.ps1
27+
28+
if ( $LastExitCode -ne 0 )
29+
{
30+
Write-Error "Failed to build."
31+
exit 1
32+
}
33+
34+
cd ..
35+
test_script:
36+
- cmd: >-
37+
cd ./build
38+
39+
./RunUnitTests35.cmd

build/RunUnitTests.cmd

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ dotnet test %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.BclExtensions/MsgPack.
44
if not %errorlevel% == 0 exit /b 1
55
dotnet test %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.CodeDom/MsgPack.UnitTest.CodeDom.csproj
66
if not %errorlevel% == 0 exit /b 1
7-
nunit3-console %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.Net35/bin/Debug/net35/MsgPack.UnitTest.Net35.dll --framework:net-3.5 --result=test-result-net35.xml;format=AppVeyor
8-
if not %errorlevel% == 0 exit /b 1
9-
nunit3-console %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.CodeDom.Net35/bin/Debug/net35/MsgPack.UnitTest.CodeDom.Net35.dll --framework:net-3.5 --result=test-result-net35-codedom.xml;format=AppVeyor
10-
if not %errorlevel% == 0 exit /b 1
117
@rem WinRT related tests require developer license...
128
@rem vstest.console /logger:Appveyor /InIsolation %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.WinRT/AppPackages/MsgPack.UnitTest.WinRT_1.1.0.0_AnyCPU_Debug_Test/MsgPack.UnitTest.WinRT_1.1.0.0_AnyCPU_Debug.appx
139
@rem vstest.console /logger:Appveyor /InIsolation %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.BclExtensions.WinRT/AppPackages/MsgPack.UnitTest.BclExtensions.WinRT_1.1.0.0_AnyCPU_Debug_Test/MsgPack.UnitTest.BclExtensions.WinRT_1.1.0.0_AnyCPU_Debug.appx

build/RunUnitTests35.cmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
nunit3-console %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.Net35/bin/Debug/net35/MsgPack.UnitTest.Net35.dll --framework:net-3.5 --result=test-result-net35.xml;format=AppVeyor
2+
if not %errorlevel% == 0 exit /b 1
3+
nunit3-console %APPVEYOR_BUILD_FOLDER%/test/MsgPack.UnitTest.CodeDom.Net35/bin/Debug/net35/MsgPack.UnitTest.CodeDom.Net35.dll --framework:net-3.5 --result=test-result-net35-codedom.xml;format=AppVeyor
4+
if not %errorlevel% == 0 exit /b 1

test/MsgPack.UnitTest.CodeDom/Serialization/ArrayCodeDomBasedAutoMessagePackSerializerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,13 +2536,13 @@ public void TestHasPrivateSetterPropertyWithBothConstructor_DeserializeWithMissi
25362536
stream.Write( new byte[]{ 0x90 } );
25372537
stream.Position = 0;
25382538
var result = serializer.Unpack( stream );
2539-
#if !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2539+
#if !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25402540
// Default constructor was called and was nothing to be set.
25412541
Assert.That( result.Member, Is.EqualTo( "ABC" ) );
25422542
#else
25432543
// Set null via deserialization constructor.
25442544
Assert.That( result.Member, Is.Null );
2545-
#endif // !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2545+
#endif // !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25462546
}
25472547
}
25482548

test/MsgPack.UnitTest.CodeDom/Serialization/MapCodeDomBasedAutoMessagePackSerializerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,13 +2561,13 @@ public void TestHasPrivateSetterPropertyWithBothConstructor_DeserializeWithMissi
25612561
stream.Write( new byte[]{ 0x80 } );
25622562
stream.Position = 0;
25632563
var result = serializer.Unpack( stream );
2564-
#if !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2564+
#if !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25652565
// Default constructor was called and was nothing to be set.
25662566
Assert.That( result.Member, Is.EqualTo( "ABC" ) );
25672567
#else
25682568
// Set null via deserialization constructor.
25692569
Assert.That( result.Member, Is.Null );
2570-
#endif // !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2570+
#endif // !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25712571
}
25722572
}
25732573

test/MsgPack.UnitTest.Silverlight.5.FullTrust/Properties/OutOfBrowserSettings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
<OutOfBrowserSettings.WindowSettings>
44
<WindowSettings Title="MsgPack.UnitTest.Silverlight.5.FullTrust アプリケーション" />
55
</OutOfBrowserSettings.WindowSettings>
6+
<OutOfBrowserSettings.SecuritySettings>
7+
<SecuritySettings ElevatedPermissions="Required" />
8+
</OutOfBrowserSettings.SecuritySettings>
69
<OutOfBrowserSettings.Icons />
710
</OutOfBrowserSettings>

test/MsgPack.UnitTest/ByteArrayPackerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#region -- License Terms --
1+
#region -- License Terms --
22
//
33
// MessagePack for CLI
44
//
@@ -34,7 +34,7 @@
3434
namespace MsgPack
3535
{
3636
[TestFixture]
37-
[Timeout( 500 )]
37+
[Timeout( 1000 )]
3838
public partial class ByteArrayPackerTest : PackerTest
3939
{
4040
protected override Packer CreatePacker( MemoryStream stream )

test/MsgPack.UnitTest/MessagePackConvertTest.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#region -- License Terms --
1+
#region -- License Terms --
22
//
33
// MessagePack for CLI
44
//
@@ -317,19 +317,21 @@ public void TestToDateTime_MinimumMinusOne_IsUtcEpoc()
317317
[Test]
318318
public void TestFromDateTimeOffset_UtcNow_AsUnixEpoc()
319319
{
320+
var utcNow = DateTimeOffset.UtcNow;
320321
Assert.AreEqual(
321-
checked( DateTime.UtcNow.Subtract( UtcEpoc ).Ticks / TicksToMilliseconds ),
322-
MessagePackConvert.FromDateTimeOffset( DateTimeOffset.UtcNow )
322+
checked( utcNow.DateTime.Subtract( UtcEpoc ).Ticks / TicksToMilliseconds ),
323+
MessagePackConvert.FromDateTimeOffset( utcNow )
323324
);
324325
}
325326

326327
[Test]
327328
public void TestFromDateTimeOffset_Now_AsUtcUnixEpoc()
328329
{
330+
var utcNow = DateTimeOffset.UtcNow;
329331
// LocalTime will be converted to UtcTime
330332
Assert.AreEqual(
331-
checked( DateTime.UtcNow.Subtract( UtcEpoc ).Ticks / TicksToMilliseconds ),
332-
MessagePackConvert.FromDateTimeOffset( DateTimeOffset.Now )
333+
checked( utcNow.DateTime.Subtract( UtcEpoc ).Ticks / TicksToMilliseconds ),
334+
MessagePackConvert.FromDateTimeOffset( utcNow.ToLocalTime() )
333335
);
334336
}
335337

test/MsgPack.UnitTest/Serialization/ArrayFieldBasedAutoMessagePackSerializerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,13 +2536,13 @@ public void TestHasPrivateSetterPropertyWithBothConstructor_DeserializeWithMissi
25362536
stream.Write( new byte[]{ 0x90 } );
25372537
stream.Position = 0;
25382538
var result = serializer.Unpack( stream );
2539-
#if !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2539+
#if !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25402540
// Default constructor was called and was nothing to be set.
25412541
Assert.That( result.Member, Is.EqualTo( "ABC" ) );
25422542
#else
25432543
// Set null via deserialization constructor.
25442544
Assert.That( result.Member, Is.Null );
2545-
#endif // !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2545+
#endif // !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25462546
}
25472547
}
25482548

test/MsgPack.UnitTest/Serialization/ArrayReflectionBasedAutoMessagePackSerializerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,13 +2536,13 @@ public void TestHasPrivateSetterPropertyWithBothConstructor_DeserializeWithMissi
25362536
stream.Write( new byte[]{ 0x90 } );
25372537
stream.Position = 0;
25382538
var result = serializer.Unpack( stream );
2539-
#if !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2539+
#if !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25402540
// Default constructor was called and was nothing to be set.
25412541
Assert.That( result.Member, Is.EqualTo( "ABC" ) );
25422542
#else
25432543
// Set null via deserialization constructor.
25442544
Assert.That( result.Member, Is.Null );
2545-
#endif // !SILVERLIGHT && !SILVERLIGHT_PREVILEGED
2545+
#endif // !SILVERLIGHT || SILVERLIGHT_PRIVILEGED
25462546
}
25472547
}
25482548

0 commit comments

Comments
 (0)