public void PersonUpdate() { const string EXPECT = "Clinton"; const string EDITED = "Notnilc"; // get it Person person = new Person(); person = Helpers.Person().Select(1); // test it Assert.IsNotNull(person, "Missing person"); Assert.IsTrue(EXPECT.Equals(person.FirstName), "Mistaken identity"); //change it person.FirstName = EDITED; Helpers.Person().Update(person); // get it again person = Helpers.Person().Select(1); // test it Assert.IsTrue(EDITED.Equals(person.FirstName), "Same old, same old?"); // change it back person.FirstName = EXPECT; Helpers.Person().Update(person); }
public void IntPerformance() { DateTime start = DateTime.Now; const int SIZE = 500; const int REPS = 500; const double EXPECT = .25; int[] a = new int[SIZE]; int[] b = new int[SIZE]; int[] c = new int[SIZE]; decimal[] d = new decimal[SIZE]; for (int i = 0; i < REPS; i++) { init(ref a); init(ref b); c = Calc.Add(a, b); c = Calc.Subtract(a, b); c = Calc.Product(a, b); d = Calc.Divide(a, b); Calc.StdDev(a); } double time = DateTime.Now.Subtract(start).TotalSeconds; Assert.LessOrEqual(time, EXPECT); Console.WriteLine("IntPerformance (expected): " + time.ToString("N2") + "s (" + EXPECT.ToString("N2") + "), reps/sec: " + (REPS / time).ToString("N0")); }