public async void Should_Convert_Get_Double_To_String() { var data = new Class1 { DoubleValue = 5.6 }; var target = new ExpressionSubject(new ExpressionObserver(data, "DoubleValue"), typeof(string)); var result = await target.Take(1); Assert.Equal("5.6", result); }
public async void Should_Convert_Get_Invalid_Double_String_To_UnsetValue() { var data = new Class1 { StringValue = "foo" }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double)); var result = await target.Take(1); Assert.Equal(PerspexProperty.UnsetValue, result); }
public async void Should_Coerce_Get_Null_String_To_Double_Deafult_Value() { var data = new Class1 { StringValue = null }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double)); var result = await target.Take(1); Assert.Equal(0.0, result); }
public async void Should_Get_Simple_Property_Value() { var data = new Class1 { StringValue = "foo" }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(string)); var result = await target.Take(1); Assert.Equal("foo", result); }
public async void Should_Convert_Get_String_To_Double() { var data = new Class1 { StringValue = "5.6" }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double)); var result = await target.Take(1); Assert.Equal(5.6, result); }
public async void Getting_Invalid_Double_String_Should_Return_BindingError() { var data = new Class1 { StringValue = "foo" }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double)); var result = await target.Take(1); Assert.IsType<BindingError>(result); }
public async void Should_Coerce_Get_Null_Double_String_To_UnsetValue() { var data = new Class1 { StringValue = null }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double)); var result = await target.Take(1); Assert.Equal(AvaloniaProperty.UnsetValue, result); }
public async void Getting_Invalid_Double_String_Should_Return_BindingError() { var data = new Class1 { StringValue = "foo" }; var target = new ExpressionSubject(new ExpressionObserver(data, "StringValue"), typeof(double)); var result = await target.Take(1); Assert.IsType <BindingError>(result); }
public async void Should_Convert_Get_Double_To_String() { CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; var data = new Class1 { DoubleValue = 5.6 }; var target = new ExpressionSubject(new ExpressionObserver(data, "DoubleValue"), typeof(string)); var result = await target.Take(1); Assert.Equal((5.6).ToString(), result); }
public async void Should_Convert_Get_Double_To_String() { Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; var data = new Class1 { DoubleValue = 5.6 }; var target = new ExpressionSubject(new ExpressionObserver(data, "DoubleValue"), typeof(string)); var result = await target.Take(1); Assert.Equal((5.6).ToString(), result); }