mirror of https://github.com/AMT-Cheif/Stylet.git
Remove 'Task.Delay(1)' from unit tests
This commit is contained in:
parent
7f14d29696
commit
477d30ab4e
|
@ -104,7 +104,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidateCallsAdapterValidate()
|
public void ValidateCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).Returns(Task.Delay(1).ContinueWith(t => new Dictionary<string, IEnumerable<string>>() { { "property", new[] { "error1", "error2" } } })).Verifiable();
|
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).ReturnsAsync(new Dictionary<string, IEnumerable<string>>() { { "property", new[] { "error1", "error2" } } }).Verifiable();
|
||||||
this.model.Validate();
|
this.model.Validate();
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -113,7 +113,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidateAsyncCallsAdapterValidate()
|
public void ValidateAsyncCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).Returns(Task.Delay(1).ContinueWith(t => new Dictionary<string, IEnumerable<string>>())).Verifiable();
|
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).ReturnsAsync(new Dictionary<string, IEnumerable<string>>()).Verifiable();
|
||||||
this.model.ValidateAsync().Wait();
|
this.model.ValidateAsync().Wait();
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -122,7 +122,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidatePropertyByNameCallsAdapterValidate()
|
public void ValidatePropertyByNameCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidatePropertyAsync("test")).Returns(Task.Delay(1).ContinueWith(t => Enumerable.Empty<string>())).Verifiable();
|
this.validator.Setup(x => x.ValidatePropertyAsync("test")).ReturnsAsync(Enumerable.Empty<string>()).Verifiable();
|
||||||
this.model.ValidateProperty("test");
|
this.model.ValidateProperty("test");
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -131,7 +131,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidatePropertyAsyncByNameCallsAdapterValidate()
|
public void ValidatePropertyAsyncByNameCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidatePropertyAsync("test")).Returns(Task.Delay(1).ContinueWith(t => Enumerable.Empty<string>())).Verifiable();
|
this.validator.Setup(x => x.ValidatePropertyAsync("test")).ReturnsAsync(Enumerable.Empty<string>()).Verifiable();
|
||||||
this.model.ValidatePropertyAsync("test").Wait();
|
this.model.ValidatePropertyAsync("test").Wait();
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -140,7 +140,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidatePropertyAsyncWithNullCallsAdapterValidate()
|
public void ValidatePropertyAsyncWithNullCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).Returns(Task.Delay(1).ContinueWith(t => new Dictionary<string, IEnumerable<string>>())).Verifiable();
|
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).ReturnsAsync(new Dictionary<string, IEnumerable<string>>()).Verifiable();
|
||||||
this.model.ValidatePropertyAsync(null).Wait();
|
this.model.ValidatePropertyAsync(null).Wait();
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -150,7 +150,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidatePropertyAsyncWithEmptyStringCallsAdapterValidate()
|
public void ValidatePropertyAsyncWithEmptyStringCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).Returns(Task.Delay(1).ContinueWith(t => new Dictionary<string, IEnumerable<string>>())).Verifiable();
|
this.validator.Setup(x => x.ValidateAllPropertiesAsync()).ReturnsAsync(new Dictionary<string, IEnumerable<string>>()).Verifiable();
|
||||||
this.model.ValidatePropertyAsync(String.Empty).Wait();
|
this.model.ValidatePropertyAsync(String.Empty).Wait();
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -158,7 +158,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidatePropertyByExpressionCallsAdapterValidate()
|
public void ValidatePropertyByExpressionCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidatePropertyAsync("IntProperty")).Returns(Task.Delay(1).ContinueWith(t => Enumerable.Empty<string>())).Verifiable();
|
this.validator.Setup(x => x.ValidatePropertyAsync("IntProperty")).ReturnsAsync(Enumerable.Empty<string>()).Verifiable();
|
||||||
this.model.ValidateProperty(() => this.model.IntProperty);
|
this.model.ValidateProperty(() => this.model.IntProperty);
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
@ -167,7 +167,7 @@ namespace StyletUnitTests
|
||||||
[Test]
|
[Test]
|
||||||
public void ValidatePropertAsyncByExpressionCallsAdapterValidate()
|
public void ValidatePropertAsyncByExpressionCallsAdapterValidate()
|
||||||
{
|
{
|
||||||
this.validator.Setup(x => x.ValidatePropertyAsync("IntProperty")).Returns(Task.Delay(1).ContinueWith(t => Enumerable.Empty<string>())).Verifiable();
|
this.validator.Setup(x => x.ValidatePropertyAsync("IntProperty")).ReturnsAsync(Enumerable.Empty<string>()).Verifiable();
|
||||||
this.model.ValidatePropertyAsync(() => this.model.IntProperty).Wait();
|
this.model.ValidatePropertyAsync(() => this.model.IntProperty).Wait();
|
||||||
|
|
||||||
this.validator.Verify();
|
this.validator.Verify();
|
||||||
|
|
Loading…
Reference in New Issue