Skip to content

Commit

Permalink
Merge pull request #1524 from Gillibald/fix/1520-BindingExpressionTests
Browse files Browse the repository at this point in the history
Fix/1520 binding expression tests
  • Loading branch information
jkoritzinsky authored Apr 29, 2018
2 parents a6f9a4f + b70981b commit 7d8530e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/Avalonia.Markup.UnitTests/Data/BindingExpressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void Should_Set_Indexed_Value()
[Fact]
public async Task Should_Convert_Get_String_To_Double()
{
var data = new Class1 { StringValue = "5.6" };
var data = new Class1 { StringValue = $"{5.6}" };
var target = new BindingExpression(new ExpressionObserver(data, "StringValue"), typeof(double));
var result = await target.Take(1);

Expand Down Expand Up @@ -94,12 +94,12 @@ public async Task Should_Coerce_Get_Null_Double_String_To_UnsetValue()
[Fact]
public void Should_Convert_Set_String_To_Double()
{
var data = new Class1 { StringValue = (5.6).ToString() };
var data = new Class1 { StringValue = $"{5.6}" };
var target = new BindingExpression(new ExpressionObserver(data, "StringValue"), typeof(double));

target.OnNext(6.7);

Assert.Equal((6.7).ToString(), data.StringValue);
Assert.Equal($"{6.7}", data.StringValue);

GC.KeepAlive(data);
}
Expand All @@ -111,7 +111,7 @@ public async Task Should_Convert_Get_Double_To_String()
var target = new BindingExpression(new ExpressionObserver(data, "DoubleValue"), typeof(string));
var result = await target.Take(1);

Assert.Equal((5.6).ToString(), result);
Assert.Equal($"{5.6}", result);

GC.KeepAlive(data);
}
Expand All @@ -122,7 +122,7 @@ public void Should_Convert_Set_Double_To_String()
var data = new Class1 { DoubleValue = 5.6 };
var target = new BindingExpression(new ExpressionObserver(data, "DoubleValue"), typeof(string));

target.OnNext("6.7");
target.OnNext($"{6.7}");

Assert.Equal(6.7, data.DoubleValue);

Expand Down Expand Up @@ -318,15 +318,15 @@ public void Should_Handle_DataValidation()

target.Subscribe(x => result.Add(x));
target.OnNext(1.2);
target.OnNext("3.4");
target.OnNext($"{3.4}");
target.OnNext("bar");

Assert.Equal(
new[]
{
new BindingNotification("5.6"),
new BindingNotification("1.2"),
new BindingNotification("3.4"),
new BindingNotification($"{5.6}"),
new BindingNotification($"{1.2}"),
new BindingNotification($"{3.4}"),
new BindingNotification(
new InvalidCastException("'bar' is not a valid number."),
BindingErrorType.Error)
Expand Down

0 comments on commit 7d8530e

Please sign in to comment.