public void Test() { var singleValue = new SingleValue { Value = 11 }; var otherValues = new ManyValues(); otherValues.Add(22); otherValues.Add(33); Assert.AreEqual(new List <IValueContainer> { singleValue, otherValues }.Sum(), 66); }
public void Test() { var s = new SingleValue { Value = 10 }; var m = new ManyValues(); m.Add(20); m.Add(30); Assert.That(new List <IValueContainer> { s, m }.Sum(), Is.EqualTo(60)); }
static void Main(string[] args) { var single = new SingleValue { Value = 3 }; Console.WriteLine($"Single sum: {single.Sum()}"); var many = new ManyValues(); many.Add(12); many.Add(6); Console.WriteLine($"Single sum: {many.Sum()}"); Console.ReadKey(); }
public static void Start() { var singleValue = new SingleValue { Value = 11 }; var otherValues = new ManyValues(); otherValues.Add(22); otherValues.Add(33); Console.WriteLine(new List <IValueContainer> { singleValue, otherValues }.Sum()); Console.WriteLine(ExtensionMethods53.Sum(new List <IValueContainer> { singleValue, otherValues })); }
public static void Main(string[] args) { var singleValue = new SingleValue { Value = 11 }; var otherValues = new ManyValues(); otherValues.Add(22); otherValues.Add(33); var sum = new List <IValueContainer> { singleValue, otherValues }.Sum(); var s = new SingleValue(); Console.WriteLine(sum); Console.ReadKey(); }
static void DemoComposite() { ManyValues items = new ManyValues(); items.Add(10); items.Add(30); items.Add(18); IValueContainer item = new SingleValue() { Value = 6 }; List <IValueContainer> containters = new List <IValueContainer>(); //containters.Add(items); //containters.Add(item); }