Skip to content

Commit

Permalink
Remove default value from parameter
Browse files Browse the repository at this point in the history
References #8
  • Loading branch information
andreashuber-lawo committed Jan 8, 2016
1 parent 26ee5ca commit 9605df1
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions Lawo.EmberPlusSharpTest/Model/ConsumerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ public void AccessTest()
AssertAccess(consumer.Root.FieldNode.FieldNode.FieldNode);
AssertAccess(consumer.Root.FieldNode.FieldNode.FieldNode.FieldNode);
return Task.FromResult(false);
}));
},
false));
}

/// <summary>Tests nullable parameter variants.</summary>
Expand Down Expand Up @@ -516,7 +517,8 @@ public void TriggerTest()
}

await Task.Delay(300);
}));
},
false));
}

/// <summary>Tests sending/receiving with a broken connection.</summary>
Expand Down Expand Up @@ -594,7 +596,8 @@ public void SlotTest()
#pragma warning disable 0618
await consumer.SendChangesAsync();
#pragma warning restore 0618
}));
},
false));
}

/// <summary>Tests the various change notifications.</summary>
Expand Down Expand Up @@ -804,7 +807,8 @@ await AssertThrowAsync<ArgumentException>(
Assert.AreEqual(42L, ex.Result.Items.First());
Assert.AreEqual(1, ex.Result.Items.Count());
}
});
},
false);
});
}

Expand Down Expand Up @@ -854,7 +858,8 @@ public void StreamTest()
consumer =>
{
return Task.FromResult(false);
}));
},
false));
}

/// <summary>Tests various exceptional conditions.</summary>
Expand Down Expand Up @@ -1012,7 +1017,8 @@ await AssertThrowAsync<ModelException>(
{
c.AutoSendInterval = 10;
return c.Root.Function.InvokeAsync(42);
}),
},
false),
"The received tuple length does not match the tuple description length of 1.");
await AssertThrowAsync<ModelException>(
() => TestWithRobot<FunctionResultMismatchRoot>(
Expand All @@ -1021,7 +1027,8 @@ await AssertThrowAsync<ModelException>(
{
c.AutoSendInterval = 10;
return c.Root.Function.InvokeAsync(42);
}),
},
false),
"The received tuple length does not match the tuple description length of 1.");
await AssertThrowInCreateAsync<ModelException, ZoneNodeRoot>(
"OfflineRequiredElementLog.xml",
Expand Down Expand Up @@ -1051,21 +1058,23 @@ public void Bug1620Test()
{
Assert.AreEqual(1, consumer.Root.FieldNode.SomeParameter.Value);
return Task.FromResult(false);
}));
},
false));
}

/// <summary>Exposes <see href="https://redmine.lawo.de/redmine/issues/1766">Bug 1766</see>.</summary>
[TestMethod]
public void Bug1766Test()
{
AsyncPump.Run(() => TestWithRobot<EmptyNodeRoot>("Bug1766Log.xml", consumer => Task.FromResult(false)));
AsyncPump.Run(
() => TestWithRobot<EmptyNodeRoot>("Bug1766Log.xml", consumer => Task.FromResult(false), false));
}

/// <summary>Exposes <see href="https://redmine.lawo.de/redmine/issues/1834">Bug 1834</see>.</summary>
[TestMethod]
public void Bug1834Test()
{
AsyncPump.Run(() => TestWithRobot<EmptyRoot>("Bug1834Log.xml", consumer => Task.FromResult(false)));
AsyncPump.Run(() => TestWithRobot<EmptyRoot>("Bug1834Log.xml", consumer => Task.FromResult(false), false));
}

/// <summary>Exposes <see href="https://redmine.lawo.de/redmine/issues/1836">Bug 1836</see>.</summary>
Expand Down Expand Up @@ -1110,7 +1119,8 @@ public void Bug1866Test()
{
Assert.AreEqual(Enumeration.Two, consumer.Root.Enum.Value);
return Task.FromResult(false);
}));
},
false));
}

/// <summary>Exposes <see href="https://redmine.lawo.de/redmine/issues/2755">Bug 2755</see>.</summary>
Expand Down Expand Up @@ -1140,7 +1150,8 @@ public void Bug3345Test()
consumer.Root.Parameter1.Value = true;
consumer.Root.Parameter2.Value = true;
await Task.Delay(1000);
}));
},
false));
}

/// <summary>Exposes <see href="https://redmine.lawo.de/redmine/issues/4424">Bug 4424</see>.</summary>
Expand Down Expand Up @@ -1440,7 +1451,7 @@ private static void AssertAccess(RecursiveFieldNode node)

[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Objects are disposed within the called method.")]
private static Task TestWithRobot<TRoot>(
string logXmlName, Func<Consumer<TRoot>, Task> testCallback, bool log = false) where TRoot : Root<TRoot>
string logXmlName, Func<Consumer<TRoot>, Task> testCallback, bool log) where TRoot : Root<TRoot>
{
return TestWithRobot<ModelPayloads>(
client => MonitorConnection(Consumer<TRoot>.CreateAsync(client, 4000), c => testCallback(c)),
Expand Down Expand Up @@ -1642,11 +1653,13 @@ private static void CheckNumbers(MainRoot root)
private static TRoot GetRoot<TRoot>(string logXmlName) where TRoot : Root<TRoot>
{
TRoot root = null;
AsyncPump.Run(() => TestWithRobot<TRoot>(logXmlName, consumer => Task.FromResult(root = consumer.Root)));
AsyncPump.Run(
() => TestWithRobot<TRoot>(logXmlName, consumer => Task.FromResult(root = consumer.Root), false));
return root;
}

private static void AssertEqual<TCollectionNode>(MainRoot mainRoot, InterfaceElementRoot<TCollectionNode> interfaceRoot) where TCollectionNode : INode
private static void AssertEqual<TCollectionNode>(
MainRoot mainRoot, InterfaceElementRoot<TCollectionNode> interfaceRoot) where TCollectionNode : INode
{
Assert.AreEqual(mainRoot.BooleanParameter.Value, interfaceRoot.BooleanParameter.Value);
Assert.AreEqual(mainRoot.IntegerParameter.Value, interfaceRoot.IntegerParameter.Value);
Expand Down

0 comments on commit 9605df1

Please sign in to comment.