public static void Main() { var strategy = new OrdinaryDiscriminantStrategy(); var solver = new QuadraticEquationSolver(strategy); var results = solver.Solve(1, 10, 16); WriteLine($"Item 1: {results.Item1}"); //Assert.That(results.Item1, Is.EqualTo(new Complex(-2, 0))); WriteLine($"Item 2: {results.Item2}"); //Assert.That(results.Item2, Is.EqualTo(new Complex(-8, 0))); results = solver.Solve(1, 4, 5); var complexNaN = new Complex(double.NaN, double.NaN); WriteLine($"Item 1: {results.Item1}"); /*Assert.That(results.Item1, Is.EqualTo(complexNaN)); * Assert.IsTrue(double.IsNaN(results.Item1.Real)); * Assert.IsTrue(double.IsNaN(results.Item1.Imaginary)); */ WriteLine($"Item 2: {results.Item2}"); /*Assert.That(results.Item2, Is.EqualTo(complexNaN)); * Assert.IsTrue(double.IsNaN(results.Item2.Real)); * Assert.IsTrue(double.IsNaN(results.Item2.Imaginary)); */ }
static void Main(string[] args) { var qes = new QuadraticEquationSolver(new RealDiscriminantStrategy()); var result = qes.Solve(1, -1, -2); Console.WriteLine(result); }
static void Main(string[] args) { var test = new OrdinaryDiscriminantStrategy(); var test2 = new QuadraticEquationSolver(test); test2.Solve(3, 2, -3); Console.WriteLine("Hello World!"); }
static void Main(string[] args) { //var strategy = new OrdinaryDiscriminantStrategy(); //var solver = new QuadraticEquationSolver(strategy); //var results = solver.Solve(1, 10, 16); //var strategy = new RealDiscriminantStrategy(); //var solver = new QuadraticEquationSolver(strategy); //var results = solver.Solve(1, 10, 16); //var strategy = new OrdinaryDiscriminantStrategy(); //var solver = new QuadraticEquationSolver(strategy); //var results = solver.Solve(1, 4, 5); var strategy = new RealDiscriminantStrategy(); var solver = new QuadraticEquationSolver(strategy); var results = solver.Solve(1, 4, 5); var complexNaN = new Complex(double.NaN, double.NaN); Console.WriteLine(results.Item1); Console.WriteLine(results.Item2); }