Skip to content

Commit 0723932

Browse files
committed
Unittesting
1 parent b1bad76 commit 0723932

File tree

14 files changed

+521
-165
lines changed

14 files changed

+521
-165
lines changed

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Ember/EmberReaderTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ namespace Lawo.EmberPlusSharp.Ember
2323
/// <summary>Tests <see cref="EmberReader"/>.</summary>
2424
[TestClass]
2525
public class EmberReaderTest : TestBase
26-
public class EmberReaderTest
2726
{
2827
/// <summary>Tests with an empty stream.</summary>
2928
[TestMethod]
@@ -204,7 +203,7 @@ public void ContainerTest()
204203
[TestMethod]
205204
public void ExceptionTest()
206205
{
207-
//TestStandardExceptionConstructors<EmberException>();
206+
TestStandardExceptionConstructors<EmberException>();
208207

209208
Assert.ThrowsException<ArgumentNullException>(() => new EmberReader(null, 1).Dispose());
210209
AssertEmberException("Incorrect length at position 3.", 0x60, 0x03, 0x0D, 0x01, 0xFF, 0x00);

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Ember/IdentifierTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class IdentifierTest : TestBase
2121
public void MainTest()
2222
{
2323
var u1 = default(EmberId);
24-
var n1 = this.Random.Next();
24+
var n1 = Random.Shared.Next();
2525
var n2 = n1 + 1;
2626
var a1 = EmberId.CreateApplication(n1);
2727
var a2 = EmberId.CreateApplication(n2);
@@ -52,10 +52,10 @@ public void MainTest()
5252

5353
/// <summary>Tests <see cref="EmberId"/> exceptions.</summary>
5454
[TestMethod]
55-
public void ExceptionTest() =>
56-
AssertThrow<ArgumentOutOfRangeException>(
57-
() => EmberId.CreateApplication(-1),
58-
() => EmberId.CreateContextSpecific(-1));
55+
public void ExceptionTest() {
56+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => EmberId.CreateApplication(-1));
57+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => EmberId.CreateContextSpecific(-1));
58+
}
5959

6060
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6161

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Lawo.EmberPlusSharpTest.csproj

Lines changed: 448 additions & 1 deletion
Large diffs are not rendered by default.

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Model/ConsumerTest.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,16 +1071,16 @@ await TestWithRobot<ZoneNodeRoot>(
10711071
Assert.AreEqual("text42", receivers.Children[0].Uri.Value);
10721072
Assert.AreEqual("text43", receivers.Children[0].Sdp.Value);
10731073
Assert.AreEqual(0, receivers.Children[0].State.Value);
1074-
//state.Value = 2;
1075-
//await WaitForChangeAsync(receivers.Children[0].GetProperty(r => r.Sdp), null);
1076-
//state.Value = 3;
1077-
//await WaitForChangeAsync(receivers.Children[0].GetProperty(r => r.Sdp));
1078-
//state.Value = 4;
1079-
//await WaitForChangeAsync(receivers.Children.GetProperty(c => c.Count), 0);
1080-
//await WaitForChangeAsync(((INode)receivers).Children.GetProperty(c => c.Count), 0);
1081-
//state.Value = 5;
1082-
//await WaitForChangeAsync(receivers.Children.GetProperty(c => c.Count), 1);
1083-
//await WaitForChangeAsync(((INode)receivers).Children.GetProperty(c => c.Count), 1);
1074+
state.Value = 2;
1075+
await WaitForChangeAsync(receivers.Children[0].GetProperty(r => r.Sdp), null);
1076+
state.Value = 3;
1077+
await WaitForChangeAsync(receivers.Children[0].GetProperty(r => r.Sdp));
1078+
state.Value = 4;
1079+
await WaitForChangeAsync(receivers.Children.GetProperty(c => c.Count), 0);
1080+
await WaitForChangeAsync(((INode)receivers).Children.GetProperty(c => c.Count), 0);
1081+
state.Value = 5;
1082+
await WaitForChangeAsync(receivers.Children.GetProperty(c => c.Count), 1);
1083+
await WaitForChangeAsync(((INode)receivers).Children.GetProperty(c => c.Count), 1);
10841084
Assert.AreEqual("text44", receivers.Children[0].Uri.Value);
10851085
Assert.AreEqual("text45", receivers.Children[0].Sdp.Value);
10861086
Assert.AreEqual(99, receivers.Children[0].State.Value);
@@ -1173,7 +1173,7 @@ await Assert.ThrowsExceptionAsync<ArgumentOutOfRangeException>(
11731173
() => Consumer<SingleNodeRoot>.CreateAsync(dummy, 10000, ChildrenRetrievalPolicy.All + 1));
11741174
}
11751175

1176-
//TestStandardExceptionConstructors<ModelException>();
1176+
TestStandardExceptionConstructors<ModelException>();
11771177

11781178
await AssertThrowInCreateAsync<TimeoutException, SingleNodeRoot>(
11791179
"IncompleteLog1.xml",
@@ -2366,10 +2366,10 @@ private Task StreamTestCore(
23662366
failFormat(GetFormat(realValue, isLittleEndian)),
23672367
0,
23682368
boolValue.ToString().ToLowerInvariant(),
2369-
new SoapHexBinary(failEncoding(intBytes.Concat(enumBytes).ToArray())),
2370-
new SoapHexBinary(failEncoding(octetStringValue)),
2369+
TestHelper.SoapHexBinary(failEncoding(intBytes.Concat(enumBytes).ToArray())),
2370+
TestHelper.SoapHexBinary(failEncoding(octetStringValue)),
23712371
failType ? "Real" : "Octetstring",
2372-
failType ? realValue : new SoapHexBinary(failEncoding(realBytes)),
2372+
failType ? realValue : TestHelper.SoapHexBinary(failEncoding(realBytes)),
23732373
stringValue
23742374
};
23752375

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Model/StreamDescriptionTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ namespace Lawo.EmberPlusSharp.Model
1515
/// <summary>Tests <see cref="StreamDescription"/>.</summary>
1616
[TestClass]
1717
public sealed class StreamDescriptionTest : TestBase
18-
public sealed class StreamDescriptionTest
1918
{
2019
/// <summary>Tests the main use cases.</summary>
2120
[TestMethod]
2221
public void MainTest()
2322
{
2423
var descr1 = (StreamDescription)typeof(StreamDescription).GetTypeInfo().DeclaredConstructors.First().Invoke(
2524
new object[] { StreamFormat.Int16BigEndian, 10 });
26-
//TestStructEquality(descr1, default(StreamDescription), (l, r) => l == r, (l, r) => l != r);
25+
TestStructEquality(descr1, default(StreamDescription), (l, r) => l == r, (l, r) => l != r);
2726
}
2827
}
2928
}

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Model/TutorialTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class TutorialTest
2828
/// <summary>Establishes a connection to a provider and creates a dynamic local copy of the database.</summary>
2929
[TestMethod]
3030
[TestCategory("Manual")]
31-
public void DynamicConnectTest() => Main();
31+
public void DynamicConnectTest() => MainTutorial();
3232

3333
/// <summary>Iterates over the dynamic local database.</summary>
3434
[TestMethod]
@@ -267,8 +267,8 @@ public void MixedModifyTest()
267267

268268
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
269269

270-
#region Main Method
271-
private static void Main()
270+
#region MainTutorial Method
271+
private static void MainTutorial()
272272
{
273273
// This is necessary so that we can execute async code in a console application.
274274
AsyncPump.Run(

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using System.Runtime.InteropServices;
1010

1111
// General
12-
[assembly: AssemblyTitle("Lawo.EmberPlusSharpTest")]
12+
//[assembly: AssemblyTitle("Lawo.EmberPlusSharpTest")]
1313
[assembly: AssemblyDescription("")]
1414

1515
// CA enforced

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTest/S101/S101ReaderTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ await AssertDecode<EmberData>(
4646
[TestMethod]
4747
public void ExceptionTest()
4848
{
49-
//TestStandardExceptionConstructors<S101Exception>();
49+
TestStandardExceptionConstructors<S101Exception>();
5050

5151
AsyncPump.Run(
5252
async () =>

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTestVB/Lawo.EmberPlusSharpTestVB.vbproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@
9191
<Reference Include="Microsoft.VisualStudio.Services.WebApi, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
9292
<HintPath>..\packages\Microsoft.VisualStudio.Services.Client.16.153.0\lib\net45\Microsoft.VisualStudio.Services.WebApi.dll</HintPath>
9393
</Reference>
94+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
95+
<HintPath>..\..\packages\MSTest.TestFramework.2.2.8\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
96+
<Private>True</Private>
97+
</Reference>
98+
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
99+
<HintPath>..\..\packages\MSTest.TestFramework.2.2.8\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
100+
<Private>True</Private>
101+
</Reference>
94102
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
95103
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
96104
</Reference>

src/EmberLibConsumer.net/Lawo.EmberPlusSharpTestVB/Model/TutorialTest.vb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ Public Class TutorialTestVB
154154
Async Function()
155155
Using client = Await ConnectAsync("localhost", 9000)
156156
Using con = Await Consumer(Of UnboundedSapphireRoot).CreateAsync(client)
157-
For Each source In con.Root.Sapphire.Sources.Children
158-
Console.WriteLine(source.Fader.Position.Value)
157+
For Each Source In con.Root.Sapphire.Sources.Children
158+
Console.WriteLine(Source.Fader.Position.Value)
159159
Next
160160
End Using
161161
End Using
@@ -186,11 +186,11 @@ Public Class TutorialTestVB
186186
Async Function()
187187
Using client = Await ConnectAsync("localhost", 9000)
188188
Using con = Await Consumer(Of MixedSapphireRoot).CreateAsync(client)
189-
For Each source In con.Root.Sapphire.Sources.Children
190-
source.Fader.DBValue.Value = -67.0
191-
source.Fader.Position.Value = 128
192-
source.Dsp.Input.LRMode.Value = LRMode.Mono
193-
source.Dsp.Input.Phase.Value = False
189+
For Each Source In con.Root.Sapphire.Sources.Children
190+
Source.Fader.DBValue.Value = -67.0
191+
Source.Fader.Position.Value = 128
192+
Source.Dsp.Input.LRMode.Value = LRMode.Mono
193+
Source.Dsp.Input.Phase.Value = False
194194
Next
195195

196196
Await con.SendAsync()

0 commit comments

Comments
 (0)