public void GPA() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<Student>(); assert.Catch<ArgumentOutOfRangeException>(() => assert.New("User", "Test", "7654321", 4.5m, "MIS")); dynamic student = assert.New("User", "Test", "7654321"); assert.Catch<ArgumentOutOfRangeException>( () => student.GPA = -0.01m ); assert.Catch<ArgumentOutOfRangeException>( () => student.GPA = 4.01m ); student.GPA = 4.0m; Assert.AreEqual(4.0m, student.GPA); student.GPA = 0.0m; Assert.AreEqual(0.0m, student.GPA); student.GPA = 2.0m; Assert.AreEqual(2.0m, student.GPA); student.GPA = 3.0m; Assert.AreEqual(3.0m, student.GPA); #if !DEBUG }); #endif }
public void Debit() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<Account>(); var p = assert.Method<bool>( "Debit", BindingFlags.Instance | BindingFlags.Public, new Param<decimal>("amount") ).Virtual(); dynamic account; account = assert.New(100m); Assert.AreEqual(100m, account.Balance); bool debit = account.Debit(23.45m); Assert.AreEqual(76.55m, account.Balance); Assert.IsTrue(debit); debit = account.Debit(76.56m); Assert.IsFalse(debit); Assert.AreEqual(76.55m, account.Balance); assert.Catch<ArgumentOutOfRangeException>(() => account.Debit(-0.01m)); Assert.AreEqual(76.55m, account.Balance); #if !DEBUG }); #endif }
public void Constructor() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<CheckingAccount>(); assert.Extends<Account>(); assert.Constructor( BindingFlags.Instance | BindingFlags.Public, new Param<decimal>("initialBalance"), new Param<decimal>("transactionFee") ); assert.NonConstructor( BindingFlags.Instance | BindingFlags.Public, new Param<decimal>("initialBalance") ); // new CheckingAccount(11.5m, -0.05m); assert.Catch<ArgumentOutOfRangeException>(() => assert.New(11.5m, -0.05m)); #if !DEBUG }); #endif }
public void Balance() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<Account>(); var p = assert.Property<decimal>( "Balance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.SetProperty ).NonVirtual(); dynamic account; account = assert.New(0m); Assert.AreEqual(0m, account.Balance); account.Balance = 123.45m; Assert.AreEqual(123.45m, account.Balance); assert.Catch<ArgumentOutOfRangeException>(() => account.Balance = -0.05m); Assert.AreEqual(123.45m, account.Balance); #if !DEBUG }); #endif }
public void TestParkInstanceMethods() { #if !DEBUG Assert.Multiple(() => { #endif var park = new TypeAssert<Park>(); dynamic actual = park.New( "Park 1", "123 Test Drive", (FacilityType)Enum.Parse(typeof(FacilityType), "National"), "444-432-9876", 5, 18, 12.34m); Assert.AreEqual("Park 1 National Park 5 AM to 6 PM $12.34", actual.Info); Assert.AreEqual("444-432-9876 123 Test Drive", actual.Contact); Assert.AreEqual(419.56m, actual.CalculateFee(34)); park.Catch<ArgumentOutOfRangeException>( () => actual = park.New( "Park 1", "123 Test Drive", (FacilityType)Enum.Parse(typeof(FacilityType), "National"), "444-432-9876", 6, 5, 12.34m) ); #if !DEBUG }); #endif }
public void DollarsCents() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<Money>(); dynamic money = Activator.CreateInstance(typeof(Money), 0, 0); Assert.AreEqual(0, money.Dollars); Assert.AreEqual(0, money.Cents); Assert.AreEqual("$0.00", money.ToString()); money.Dollars = 2; Assert.AreEqual(2, money.Dollars); Assert.AreEqual(0, money.Cents); Assert.AreEqual("$2.00", money.ToString()); assert.Catch<ArgumentOutOfRangeException>(() => money.Dollars = -1); Assert.AreEqual(2, money.Dollars); Assert.AreEqual(0, money.Cents); Assert.AreEqual("$2.00", money.ToString()); money.Cents = 59; Assert.AreEqual(2, money.Dollars); Assert.AreEqual(59, money.Cents); Assert.AreEqual("$2.59", money.ToString()); money.Cents = 590; Assert.AreEqual(7, money.Dollars); Assert.AreEqual(90, money.Cents); Assert.AreEqual("$7.90", money.ToString()); money.Cents = -456; // $7.00 - $4.56 = $2.44 Assert.AreEqual(2, money.Dollars); Assert.AreEqual(44, money.Cents); Assert.AreEqual("$2.44", money.ToString()); assert.Catch<ArgumentOutOfRangeException>(() => money.Cents = -245); Assert.AreEqual(2, money.Dollars); Assert.AreEqual(44, money.Cents); Assert.AreEqual("$2.44", money.ToString()); #if !DEBUG }); #endif }
public void Constructor() { var assert = new TypeAssert <Account>(); assert.Constructor( BindingFlags.Instance | BindingFlags.Public, new Param <decimal>("balance") ); dynamic account; // new Account(1000.5m); account = assert.New(1000.5m); Assert.AreEqual(1000.5m, account.Balance); assert.Catch <ArgumentOutOfRangeException>(() => account = assert.New(-0.5m)); }
public void NewMoney() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<Money>(); dynamic money; // money = new Money(12, 34); money = assert.New(12, 34); Assert.AreEqual(12, money.Dollars); Assert.AreEqual(34, money.Cents); Assert.AreEqual($"{12.34:C}", money.ToString()); assert.Catch<ArgumentOutOfRangeException>(() => money = assert.New(-1, 99)); #if !DEBUG }); #endif }
public void Constructor() { var assert = new TypeAssert <SavingsAccount>(); assert.Extends <Account>(); assert.Constructor( BindingFlags.Instance | BindingFlags.Public, new Param <decimal>("initialBalance"), new Param <decimal>("transactionFee") ); assert.NonConstructor( BindingFlags.Instance | BindingFlags.Public, new Param <decimal>("initialBalance") ); // new SavingsAccount(11.5m, -0.05m); assert.Catch <ArgumentOutOfRangeException>(() => assert.New(11.5m, -0.05m)); }
public void IncrementDecrementMoney() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<Money>(); dynamic money, added, minus; money = assert.New(12, 34); added = assert.New(56, 68); money.IncrementMoney(added); Assert.AreEqual(69, money.Dollars); Assert.AreEqual(2, money.Cents); Assert.AreEqual("$69.02", money.ToString()); Assert.AreEqual(56, added.Dollars); Assert.AreEqual(68, added.Cents); Assert.AreEqual("$56.68", added.ToString()); money = assert.New(12, 34); minus = assert.New(3, 35); money.DecrementMoney(minus); Assert.AreEqual(8, money.Dollars); Assert.AreEqual(99, money.Cents); Assert.AreEqual("$8.99", money.ToString()); Assert.AreEqual(3, minus.Dollars); Assert.AreEqual(35, minus.Cents); Assert.AreEqual("$3.35", minus.ToString()); money = assert.New(12, 34); minus = assert.New(12, 35); assert.Catch<ArgumentOutOfRangeException>(() => money.DecrementMoney(minus)); Assert.AreEqual(12, money.Dollars); Assert.AreEqual(34, money.Cents); Assert.AreEqual("$12.34", money.ToString()); Assert.AreEqual(12, minus.Dollars); Assert.AreEqual(35, minus.Cents); Assert.AreEqual("$12.35", minus.ToString()); #if !DEBUG }); #endif }
public void Credit() { var assert = new TypeAssert <Account>(); var p = assert.Method <bool>( "Credit", BindingFlags.Instance | BindingFlags.Public, new Param <decimal>("amount") ).Virtual(); dynamic account; account = assert.New(100m); Assert.AreEqual(100m, account.Balance); bool credit = account.Credit(123.45m); Assert.AreEqual(223.45m, account.Balance); Assert.IsTrue(credit); assert.Catch <ArgumentOutOfRangeException>(() => account.Credit(-0.45m)); Assert.AreEqual(223.45m, account.Balance); }
public void TestAppend() { #if !DEBUG Assert.Multiple(() => { #endif var count = new TypeAssert<Count>(); var sum = new TypeAssert<Sum>(); var average = new TypeAssert<Average>(); dynamic a = count.New(new int[] { 1, 2, 3, 4 }); dynamic b = sum.New(new int[] { 5, 6, 7 }); dynamic c = average.New(new int[] { 4, 3, 2, 1, 6 }); average.Catch<ArgumentNullException>(() => average.New(null)); average.Catch<ArgumentNullException>(() => sum.New(null)); average.Catch<ArgumentNullException>(() => count.New(null)); average.Catch<ArgumentOutOfRangeException>(() => average.New(new int[0])); average.Catch<ArgumentNullException>(() => a.Append(null)); average.Catch<ArgumentNullException>(() => b.Append(null)); average.Catch<ArgumentNullException>(() => c.Append(null)); a.Append(b); Assert.AreEqual("1 2 3 4 5 6 7", a.ToString()); Assert.AreEqual(7, a.Value); Assert.AreEqual("5 6 7", b.ToString()); Assert.AreEqual(18, b.Value); a = sum.New(new[] { 3, 2 }); b.Append(a); Assert.AreEqual("8 8 7", b.ToString()); Assert.AreEqual(23, b.Value); b.Append(c); Assert.AreEqual("12 11 9 1 6", b.ToString()); Assert.AreEqual(39, b.Value); Assert.AreEqual("4 3 2 1 6", c.ToString()); Assert.AreEqual(3, c.Value); #if !DEBUG }); #endif }
public void TestListCalcData() { var assert = new TypeAssert <ListCalc>(); dynamic o; assert.Catch <ArgumentNullException>(() => o = assert.New(null)); assert.Catch <ArgumentException>(() => o = assert.New()); assert.Catch <ArgumentException>(() => o = assert.New(0)); assert.Catch <ArgumentException>(() => o = assert.New(1)); assert.Catch <ArgumentException>(() => o = assert.New(1000)); o = assert.New(1, 2); Assert.AreEqual(5, o.Calculate()); Assert.AreEqual("1, 2", o.ToString()); o = assert.New(1, 2, 3); Assert.AreEqual(14, o.Calculate()); Assert.AreEqual("1, 2, 3", o.ToString()); o = assert.New(1, 2, 3, 4); Assert.AreEqual(16, o.Calculate()); Assert.AreEqual("1, 2; 3, 4", o.ToString()); o = assert.New(1, 2, 3, 4, 5); Assert.AreEqual(31, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6); Assert.AreEqual(46, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7); Assert.AreEqual(51, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8); Assert.AreEqual(75, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9); Assert.AreEqual(96, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Assert.AreEqual(104, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); Assert.AreEqual(137, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); Assert.AreEqual(164, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); Assert.AreEqual(175, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); Assert.AreEqual(217, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); Assert.AreEqual(250, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); Assert.AreEqual(264, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); Assert.AreEqual(315, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18); Assert.AreEqual(354, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); Assert.AreEqual(371, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); Assert.AreEqual(431, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); Assert.AreEqual(476, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18; 19, 20, 21", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22); Assert.AreEqual(496, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); Assert.AreEqual(565, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24); Assert.AreEqual(616, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18; 19, 20, 21; 22, 23, 24", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25); Assert.AreEqual(639, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26); Assert.AreEqual(717, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25, 26", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27); Assert.AreEqual(774, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18; 19, 20, 21; 22, 23, 24; 25, 26, 27", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28); Assert.AreEqual(800, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25, 26; 27, 28", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29); Assert.AreEqual(887, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25, 26; 27, 28, 29", o.ToString()); o = assert.New(3, 86, 36, 49, 71, 29, 95, 9, 31, 11, 93, 36, 46, 87, 50, 34, 72, 44, 83, 38, 17, 91, 56, 66, 99, 34, 25, 38, 99, 86, 95, 91, 84, 22, 34, 30, 27, 97, 47, 81, 84, 97, 10, 80, 33, 67, 70, 88, 77, 49, 52, 70, 15, 35, 18, 11, 31, 69, 50, 38, 4, 57, 10, 45, 16, 3, 52, 25, 54, 20, 7, 75, 97, 2, 54, 20, 82, 75, 33, 32, 63, 37, 60, 51, 35, 26, 76, 49, 4, 23, 99, 57, 47, 10, 77, 27, 87, 65, 65, 31); Assert.AreEqual(10105, o.Calculate()); Assert.AreEqual("3, 86; 36, 49, 71; 29, 95, 9; 31, 11, 93; 36, 46, 87; 50, 34, 72; 44, 83, 38; 17, 91, 56; 66, 99, 34; 25, 38, 99; 86, 95, 91; 84, 22, 34; 30, 27, 97; 47, 81, 84; 97, 10, 80; 33, 67, 70; 88, 77, 49; 52, 70, 15; 35, 18, 11; 31, 69, 50; 38, 4, 57; 10, 45, 16; 3, 52, 25; 54, 20, 7; 75, 97, 2; 54, 20, 82; 75, 33, 32; 63, 37, 60; 51, 35, 26; 76, 49, 4; 23, 99, 57; 47, 10, 77; 27, 87, 65; 65, 31", o.ToString()); /* * var sb = new StringBuilder(); * var list = new List<int>(); * * for (int i = 0; i < 100; i++) * { * list.Add(Utils.Random.Next(1, 100)); * } * * var a = list.ToArray(); * o = assert.New(a); * sb.AppendLine($"o = assert.New({string.Join(", ", list.ToArray())});"); * sb.AppendLine($"Assert.AreEqual({o.Calculate()}, o.Calculate());"); * sb.AppendLine($"Assert.AreEqual(\"{o}\", o.ToString());"); * sb.AppendLine(); * Assert.Fail(sb.ToString()); */ }
public void TestListCalc() { #if !DEBUG Assert.Multiple(() => { #endif var assert = new TypeAssert<ListCalc>(); assert.Class(); assert.Constructor( BindingFlags.Public | BindingFlags.Instance, new Param<List<ICalc>>("calculations") ); assert.Constructor( BindingFlags.Public | BindingFlags.Instance, new Param<int[]>("values") { Params = true } ); assert.Field<List<ICalc>>( "Calculations", BindingFlags.NonPublic | BindingFlags.Instance ).Protected().ReadOnly(); assert.Method<int>( "Calculate", BindingFlags.Public | BindingFlags.Instance ); assert.Method<string>( "ToString", BindingFlags.Public | BindingFlags.Instance ).Override(); dynamic o; assert.Catch<ArgumentNullException>(() => o = assert.New(null)); assert.Catch<ArgumentException>(() => o = assert.New()); assert.Catch<ArgumentException>(() => o = assert.New(0)); assert.Catch<ArgumentException>(() => o = assert.New(1)); assert.Catch<ArgumentException>(() => o = assert.New(1000)); o = assert.New(1, 2); Assert.AreEqual(5, o.Calculate()); Assert.AreEqual("1, 2", o.ToString()); o = assert.New(1, 2, 3); Assert.AreEqual(14, o.Calculate()); Assert.AreEqual("1, 2, 3", o.ToString()); o = assert.New(1, 2, 3, 4); Assert.AreEqual(16, o.Calculate()); Assert.AreEqual("1, 2; 3, 4", o.ToString()); o = assert.New(1, 2, 3, 4, 5); Assert.AreEqual(31, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6); Assert.AreEqual(46, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7); Assert.AreEqual(51, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8); Assert.AreEqual(75, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9); Assert.AreEqual(96, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Assert.AreEqual(104, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); Assert.AreEqual(137, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); Assert.AreEqual(164, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); Assert.AreEqual(175, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); Assert.AreEqual(217, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); Assert.AreEqual(250, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); Assert.AreEqual(264, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); Assert.AreEqual(315, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18); Assert.AreEqual(354, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); Assert.AreEqual(371, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); Assert.AreEqual(431, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); Assert.AreEqual(476, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18; 19, 20, 21", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22); Assert.AreEqual(496, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); Assert.AreEqual(565, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24); Assert.AreEqual(616, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18; 19, 20, 21; 22, 23, 24", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25); Assert.AreEqual(639, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26); Assert.AreEqual(717, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25, 26", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27); Assert.AreEqual(774, o.Calculate()); Assert.AreEqual("1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12; 13, 14, 15; 16, 17, 18; 19, 20, 21; 22, 23, 24; 25, 26, 27", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28); Assert.AreEqual(800, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25, 26; 27, 28", o.ToString()); o = assert.New(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29); Assert.AreEqual(887, o.Calculate()); Assert.AreEqual("1, 2; 3, 4, 5; 6, 7, 8; 9, 10, 11; 12, 13, 14; 15, 16, 17; 18, 19, 20; 21, 22, 23; 24, 25, 26; 27, 28, 29", o.ToString()); o = assert.New(3, 86, 36, 49, 71, 29, 95, 9, 31, 11, 93, 36, 46, 87, 50, 34, 72, 44, 83, 38, 17, 91, 56, 66, 99, 34, 25, 38, 99, 86, 95, 91, 84, 22, 34, 30, 27, 97, 47, 81, 84, 97, 10, 80, 33, 67, 70, 88, 77, 49, 52, 70, 15, 35, 18, 11, 31, 69, 50, 38, 4, 57, 10, 45, 16, 3, 52, 25, 54, 20, 7, 75, 97, 2, 54, 20, 82, 75, 33, 32, 63, 37, 60, 51, 35, 26, 76, 49, 4, 23, 99, 57, 47, 10, 77, 27, 87, 65, 65, 31); Assert.AreEqual(10105, o.Calculate()); Assert.AreEqual("3, 86; 36, 49, 71; 29, 95, 9; 31, 11, 93; 36, 46, 87; 50, 34, 72; 44, 83, 38; 17, 91, 56; 66, 99, 34; 25, 38, 99; 86, 95, 91; 84, 22, 34; 30, 27, 97; 47, 81, 84; 97, 10, 80; 33, 67, 70; 88, 77, 49; 52, 70, 15; 35, 18, 11; 31, 69, 50; 38, 4, 57; 10, 45, 16; 3, 52, 25; 54, 20, 7; 75, 97, 2; 54, 20, 82; 75, 33, 32; 63, 37, 60; 51, 35, 26; 76, 49, 4; 23, 99, 57; 47, 10, 77; 27, 87, 65; 65, 31", o.ToString()); /* var sb = new StringBuilder(); var list = new List<int>(); for (int i = 0; i < 100; i++) { list.Add(Utils.Random.Next(1, 100)); } var a = list.ToArray(); o = assert.New(a); sb.AppendLine($"o = assert.New({string.Join(", ", list.ToArray())});"); sb.AppendLine($"Assert.AreEqual({o.Calculate()}, o.Calculate());"); sb.AppendLine($"Assert.AreEqual(\"{o}\", o.ToString());"); sb.AppendLine(); Assert.Fail(sb.ToString()); */ #if !DEBUG }); #endif }