本文整理汇总了C#中ExpressionObserver.Take方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionObserver.Take方法的具体用法?C# ExpressionObserver.Take怎么用?C# ExpressionObserver.Take使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionObserver
的用法示例。
在下文中一共展示了ExpressionObserver.Take方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_Get_UnsetValue_For_Object_Without_Indexer
public async void Should_Get_UnsetValue_For_Object_Without_Indexer()
{
var data = new { Foo = 5 };
var target = new ExpressionObserver(data, "Foo[noindexer]");
var result = await target.Take(1);
Assert.Equal(AvaloniaProperty.UnsetValue, result);
}
示例2: Should_Get_Simple_Property_Value
public async void Should_Get_Simple_Property_Value()
{
var data = new Class1();
var target = new ExpressionObserver(data, "Foo");
var result = await target.Take(1);
Assert.Equal("foo", result);
}
示例3: Array_Out_Of_Bounds_Should_Return_UnsetValue
public async void Array_Out_Of_Bounds_Should_Return_UnsetValue()
{
var data = new { Foo = new[] { "foo", "bar" } };
var target = new ExpressionObserver(data, "Foo[2]");
var result = await target.Take(1);
Assert.Equal(AvaloniaProperty.UnsetValue, result);
}
示例4: Should_Get_UnsetValue_For_Invalid_Dictionary_Index
public async void Should_Get_UnsetValue_For_Invalid_Dictionary_Index()
{
var data = new { Foo = new Dictionary<int, string> { { 1, "foo" } } };
var target = new ExpressionObserver(data, "Foo[invalid]");
var result = await target.Take(1);
Assert.Equal(AvaloniaProperty.UnsetValue, result);
}
示例5: Should_Get_Simple_Property_Value_Null
public async void Should_Get_Simple_Property_Value_Null()
{
var data = new { Foo = (string)null };
var target = new ExpressionObserver(data, "Foo");
var result = await target.Take(1);
Assert.Null(result);
}
示例6: Should_Negate_True_String
public async void Should_Negate_True_String()
{
var data = new { Foo = "True" };
var target = new ExpressionObserver(data, "!Foo");
var result = await target.Take(1);
Assert.Equal(false, result);
}
示例7: Should_Negate_Boolean_Value
public async void Should_Negate_Boolean_Value()
{
var data = new { Foo = true };
var target = new ExpressionObserver(data, "!Foo");
var result = await target.Take(1);
Assert.Equal(false, result);
}
示例8: Should_Negate_0
public async void Should_Negate_0()
{
var data = new { Foo = 0 };
var target = new ExpressionObserver(data, "!Foo");
var result = await target.Take(1);
Assert.Equal(true, result);
}
示例9: Should_Get_Value_For_String_Indexer
public async void Should_Get_Value_For_String_Indexer()
{
var data = new { Foo = new Dictionary<string, string> { { "foo", "bar" }, { "baz", "qux" } } };
var target = new ExpressionObserver(data, "Foo[foo]");
var result = await target.Take(1);
Assert.Equal("bar", result);
}
示例10: Should_Get_Value_For_Non_String_Indexer
public async void Should_Get_Value_For_Non_String_Indexer()
{
var data = new { Foo = new Dictionary<double, string> { { 1.0, "bar" }, { 2.0, "qux" } } };
var target = new ExpressionObserver(data, "Foo[1.0]");
var result = await target.Take(1);
Assert.Equal("bar", result);
}
示例11: Should_Get_Simple_Property_Chain
public async void Should_Get_Simple_Property_Chain()
{
var data = new { Foo = new { Bar = new { Baz = "baz" } } };
var target = new ExpressionObserver(data, "Foo.Bar.Baz");
var result = await target.Take(1);
Assert.Equal("baz", result);
}
示例12: Array_With_Wrong_Dimensions_Should_Return_UnsetValue
public async void Array_With_Wrong_Dimensions_Should_Return_UnsetValue()
{
var data = new { Foo = new[] { "foo", "bar" } };
var target = new ExpressionObserver(data, "Foo[1,2]");
var result = await target.Take(1);
Assert.Equal(PerspexProperty.UnsetValue, result);
}
示例13: Should_Get_UnsetValue_For_Invalid_Array_Index
public async void Should_Get_UnsetValue_For_Invalid_Array_Index()
{
var data = new { Foo = new[] { "foo", "bar" } };
var target = new ExpressionObserver(data, "Foo[invalid]");
var result = await target.Take(1);
Assert.Equal(AvaloniaProperty.UnsetValue, result);
}
示例14: Should_Get_Simple_Property_From_Base_Class
public async void Should_Get_Simple_Property_From_Base_Class()
{
var data = new Class3 { Foo = "foo" };
var target = new ExpressionObserver(data, "Foo");
var result = await target.Take(1);
Assert.Equal("foo", result);
}
示例15: Should_Return_UnsetValue_For_Observable_Root_Null
public async void Should_Return_UnsetValue_For_Observable_Root_Null()
{
var data = new Class3 { Foo = "foo" };
var target = new ExpressionObserver(Observable.Return(default(object)), "Foo");
var result = await target.Take(1);
Assert.Equal(AvaloniaProperty.UnsetValue, result);
}