本文整理汇总了C#中Customer.With方法的典型用法代码示例。如果您正苦于以下问题:C# Customer.With方法的具体用法?C# Customer.With怎么用?C# Customer.With使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer.With方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_be_able_to_add_const_to_enumerable
public void Should_be_able_to_add_const_to_enumerable(
Customer myClass)
{
const string newValue = "const";
var ret = myClass.With(m => m.Preferences.Add(newValue));
Assert.Equal(newValue, ret.Preferences.Last());
ret = myClass.With(m => m.Preferences.Concat(new[] { newValue }));
Assert.Equal(newValue, ret.Preferences.Last());
var array = new[] { newValue };
ret = myClass.With(m => m.Preferences.Concat(array));
Assert.Equal(newValue, ret.Preferences.Last());
}
示例2: Should_be_able_to_remove_from_enumerable
public void Should_be_able_to_remove_from_enumerable(
Customer myClass)
{
var first = myClass.Preferences.First();
var ret = myClass.With(m => m.Preferences.Remove(first));
Assert.NotEqual(first, ret.Preferences.First());
}
示例3: Should_be_able_to_add_to_enumerable
public void Should_be_able_to_add_to_enumerable(
Customer myClass, string newValue)
{
var ret = myClass.With(m => m.Preferences.Add(newValue));
Assert.Equal(newValue, ret.Preferences.Last());
}
示例4: Should_be_able_to_add_range_with_new_array_to_enumerable
public void Should_be_able_to_add_range_with_new_array_to_enumerable(
Customer myClass, string newValue)
{
var ret = myClass.With(m => m.Preferences.AddRange(new[] { newValue }));
Assert.Equal(newValue, ret.Preferences.Last());
}
示例5: Should_be_able_to_add_range_to_enumerable
public void Should_be_able_to_add_range_to_enumerable(
Customer myClass, IEnumerable<string> newValue)
{
var ret = myClass.With(m => m.Preferences.AddRange(newValue));
Assert.Equal(newValue.Last(), ret.Preferences.Last());
}
示例6: Able_to_set_array_to_empty_array
public void Able_to_set_array_to_empty_array(
Customer myClass, string newValue)
{
var ret = myClass.With(m => m.Preferences == new string[0]);
Assert.Equal(new string[0], ret.Preferences.ToArray());
}
示例7: Should_be_able_to_union_add_to_enumerable
public void Should_be_able_to_union_add_to_enumerable(
Customer myClass, string newValue)
{
var ret = myClass.With(m => m.Preferences.Union(new[] { newValue }));
Assert.Equal(newValue, ret.Preferences.Last());
var array = new[] { newValue };
ret = myClass.With(m => m.Preferences.Union(array));
Assert.Equal(newValue, ret.Preferences.Last());
}