public void TestHighlyUnusualStake() { Int32 stake = 1000; double averageStake = 10; Assert.AreEqual(true, Evalulator.IsStakeUnusual(stake, averageStake), "Highly Unsual stake not determined correctly"); }
public void TestNormalStake() { Int32 stake = 100; double averageStake = 50; Assert.AreEqual(false, Evalulator.IsStakeUnusual(stake, averageStake), "Normal stake not determined correctly"); }
public void TestNormalCustomer() { Int32 customer = 2; List <Int32> riskyCustomers = new List <Int32> { 1 }; Assert.AreEqual(false, Evalulator.IsCustomerRisky(customer, riskyCustomers), "Normal customer not determined correctly"); }
public void TestRiskyCustomer() { Int32 customer = 1; List <Int32> riskyCustomers = new List <Int32> { 1 }; Assert.AreEqual(true, Evalulator.IsCustomerRisky(customer, riskyCustomers), "Risky customer not determined correctly"); }
private static void Main(string[] args) { var showTree = false; while (true) { Console.Write("> "); var line = Console.ReadLine(); if (string.IsNullOrWhiteSpace(line)) { return; } switch (line) { case "#showTree": showTree = !showTree; Console.WriteLine(showTree ? "Now showing tree." : "Tree is now hidden."); continue; case "#cls": Console.Clear(); continue; } var syntaxTree = SyntaxTree.Parse(line); var binder = new Binder(); var boundExpression = binder.BindExpression(syntaxTree.Root); var diagnostics = syntaxTree.Diagnostics.Concat(binder.Diagnostics).ToArray(); if (showTree) { Console.ForegroundColor = ConsoleColor.DarkGray; PrettyPrint(syntaxTree.Root); Console.ResetColor(); } if (!diagnostics.Any()) { var evalulator = new Evalulator(boundExpression); var result = evalulator.Evalulate(); Console.WriteLine(result); } else { Console.ForegroundColor = ConsoleColor.DarkRed; foreach (var diagnostic in diagnostics) { Console.WriteLine(diagnostic); } Console.ResetColor(); } } }
public void TestHighPayout() { Int32 payout = 2000; Assert.AreEqual(true, Evalulator.IsHighPayoutBet(payout), "High payout not determined correctly"); }
public void TestNormalPayout() { Int32 payout = 100; Assert.AreEqual(false, Evalulator.IsHighPayoutBet(payout), "Normal payout not determined correctly"); }