Skip to content

Commit

Permalink
Add test environment for streams
Browse files Browse the repository at this point in the history
References #8
  • Loading branch information
andreashuber-lawo committed Jan 8, 2016
1 parent 80ec798 commit 9201e67
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lawo.EmberPlusSharpTest/Lawo.EmberPlusSharpTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<Compile Include="Model\Test\EmptyZoneNode.cs" />
<Compile Include="Model\Test\EmptyZoneNodeRoot.cs" />
<Compile Include="Model\Test\InterfaceElementRoot.cs" />
<Compile Include="Model\Test\StreamRoot.cs" />
<Compile Include="Model\Test\ZoneNodeRoot.cs" />
<Compile Include="Model\Test\TwoParameterRoot.cs" />
<Compile Include="Model\Test\FunctionRoot.cs" />
Expand Down Expand Up @@ -576,6 +577,9 @@
<ItemGroup>
<EmbeddedResource Include="Model\Test\EmberDataPayloads\SapphireLog.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Model\Test\EmberDataPayloads\StreamLog.xml" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions Lawo.EmberPlusSharpTest/Model/ConsumerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,18 @@ await WaitForChangeAsync(
});
}

/// <summary>Tests various streaming scenarios.</summary>
[TestMethod]
public void StreamTest()
{
AsyncPump.Run(() => TestWithRobot<StreamRoot>(
"StreamLog.xml",
consumer =>
{
return Task.FromResult(false);
}));
}

/// <summary>Tests various exceptional conditions.</summary>
[TestMethod]
public void ExceptionTest()
Expand Down
171 changes: 171 additions & 0 deletions Lawo.EmberPlusSharpTest/Model/Test/EmberDataPayloads/StreamLog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2012-2015 Lawo AG (http://www.lawo.com). -->
<!-- Distributed under the Boost Software License, Version 1.0. -->
<!-- (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
<S101Log>
<Event type="Message" timeUtc="17:42:02.47" direction="Receive" number="1">
<Slot>00</Slot>
<Command>EmberData 01 0A 02</Command>
<Payload>
<Root type="RootElementCollection">
<RootElement type="Command">
<number type="Integer">32</number>
</RootElement>
</Root>
</Payload>
</Event>
<Event type="Message" timeUtc="17:42:02.52" direction="Send" number="2">
<Slot>00</Slot>
<Command>EmberData 01 0A 02</Command>
<Payload>
<Root type="RootElementCollection">
<RootElement type="Parameter">
<number type="Integer">1</number>
<contents type="Set">
<identifier type="UTF8String">BooleanParameter</identifier>
<value type="Boolean">false</value>
<streamIdentifier type="Integer">0</streamIdentifier>
</contents>
</RootElement>
<RootElement type="Parameter">
<number type="Integer">2</number>
<contents type="Set">
<identifier type="UTF8String">IntegerParameter</identifier>
<value type="Integer">0</value>
<streamIdentifier type="Integer">1</streamIdentifier>
<streamDescriptor type="StreamDescription">
<format type="Integer">0</format>
<offset type="Integer">0</offset>
</streamDescriptor>
</contents>
</RootElement>
<RootElement type="Parameter">
<number type="Integer">3</number>
<contents type="Set">
<identifier type="UTF8String">EnumerationParameter</identifier>
<value type="Integer">0</value>
<enumeration type="UTF8String">Zero
One
Two
Three</enumeration>
<type type="Integer">6</type>
<streamIdentifier type="Integer">1</streamIdentifier>
<streamDescriptor type="StreamDescription">
<format type="Integer">0</format>
<offset type="Integer">3</offset>
</streamDescriptor>
</contents>
</RootElement>
<RootElement type="Parameter">
<number type="Integer">4</number>
<contents type="Set">
<identifier type="UTF8String">OctetstringParameter</identifier>
<value type="Octetstring"></value>
<streamIdentifier type="Integer">2</streamIdentifier>
</contents>
</RootElement>
<RootElement type="Parameter">
<number type="Integer">5</number>
<contents type="Set">
<identifier type="UTF8String">RealParameter</identifier>
<value type="Real">0</value>
<streamIdentifier type="Integer">3</streamIdentifier>
</contents>
</RootElement>
<RootElement type="Parameter">
<number type="Integer">6</number>
<contents type="Set">
<identifier type="UTF8String">StringParameter</identifier>
<value type="UTF8String"></value>
<streamIdentifier type="Integer">4</streamIdentifier>
</contents>
</RootElement>
</Root>
</Payload>
</Event>
<Event type="Message" timeUtc="17:42:02.64" direction="Receive" number="2">
<Slot>00</Slot>
<Command>EmberData 01 0A 02</Command>
<Payload>
<Root type="RootElementCollection">
<RootElement type="QualifiedParameter">
<path type="RelativeObjectIdentifier">1</path>
<children type="ElementCollection">
<Element type="Command">
<number type="Integer">30</number>
</Element>
</children>
</RootElement>
<RootElement type="QualifiedParameter">
<path type="RelativeObjectIdentifier">2</path>
<children type="ElementCollection">
<Element type="Command">
<number type="Integer">30</number>
</Element>
</children>
</RootElement>
<RootElement type="QualifiedParameter">
<path type="RelativeObjectIdentifier">3</path>
<children type="ElementCollection">
<Element type="Command">
<number type="Integer">30</number>
</Element>
</children>
</RootElement>
<RootElement type="QualifiedParameter">
<path type="RelativeObjectIdentifier">4</path>
<children type="ElementCollection">
<Element type="Command">
<number type="Integer">30</number>
</Element>
</children>
</RootElement>
<RootElement type="QualifiedParameter">
<path type="RelativeObjectIdentifier">5</path>
<children type="ElementCollection">
<Element type="Command">
<number type="Integer">30</number>
</Element>
</children>
</RootElement>
<RootElement type="QualifiedParameter">
<path type="RelativeObjectIdentifier">6</path>
<children type="ElementCollection">
<Element type="Command">
<number type="Integer">30</number>
</Element>
</children>
</RootElement>
</Root>
</Payload>
</Event>
<Event type="Message" timeUtc="17:42:02.66" direction="Send" number="4">
<Slot>00</Slot>
<Command>EmberData 01 0A 02</Command>
<Payload>
<Root type="StreamCollection">
<StreamEntry type="StreamEntry">
<streamIdentifier type="Integer">0</streamIdentifier>
<streamValue type="Boolean">true</streamValue>
</StreamEntry>
<StreamEntry type="StreamEntry">
<streamIdentifier type="Integer">1</streamIdentifier>
<streamValue type="Octetstring">2A2B2C0203</streamValue>
</StreamEntry>
<StreamEntry type="StreamEntry">
<streamIdentifier type="Integer">2</streamIdentifier>
<streamValue type="Octetstring">BCD7C4C43CED13</streamValue>
</StreamEntry>
<StreamEntry type="StreamEntry">
<streamIdentifier type="Integer">3</streamIdentifier>
<streamValue type="Real">3.14159265359</streamValue>
</StreamEntry>
<StreamEntry type="StreamEntry">
<streamIdentifier type="Integer">4</streamIdentifier>
<streamValue type="UTF8String">Hello</streamValue>
</StreamEntry>
</Root>
</Payload>
</Event>
</S101Log>

26 changes: 26 additions & 0 deletions Lawo.EmberPlusSharpTest/Model/Test/StreamRoot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2012-2015 Lawo AG (http://www.lawo.com).</copyright>
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Lawo.EmberPlusSharp.Model.Test
{
using System.Diagnostics.CodeAnalysis;

[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Instantiated through reflection.")]
internal sealed class StreamRoot : Root<StreamRoot>
{
internal BooleanParameter BooleanParameter { get; private set; }

internal IntegerParameter IntegerParameter { get; private set; }

internal EnumParameter<Enumeration> EnumerationParameter { get; private set; }

internal OctetstringParameter OctetstringParameter { get; private set; }

internal RealParameter RealParameter { get; private set; }

internal StringParameter StringParameter { get; private set; }
}
}

0 comments on commit 9201e67

Please sign in to comment.