public void CalculateTest(double firstAgrument, double secondArgument, double expectedResult) { var calculator = new GeometricCalculator(); var actualResult = calculator.Calculate(firstAgrument, secondArgument); Assert.AreEqual(expectedResult, actualResult, 0.001); }
public void CalculationTest(double firstValue, double secondValue, double expected) { var calculator = new GeometricCalculator(); var actualResult = calculator.Calculate(firstValue, secondValue); Assert.AreEqual(expected, actualResult, 0.01); }
public void GetAreaAllNullArray() { var calc = new GeometricCalculator(); float expected = 0f; var actual = calc.GetArea(new GeometricThing[] { null }); Assert.AreEqual(expected, actual); }
public void GetCircumferenceTestNull() { var calc = new GeometricCalculator(); var actual = calc.GetCircumference(new IGeometricThing[] { null }); var expected = 0; Assert.AreEqual(expected, actual); }
public void GetAreaTestOneShapeNull() { var calc = new GeometricCalculator(); float expected = 0f; var square = new Geometry.Square(0); var actual = calc.GetArea(square); Assert.AreEqual(expected, actual); }
public void GetPerimeterTestOneShapeNegative() { var calc = new GeometricCalculator(); float expected = 0f; var square = new Geometry.Square(-10); var actual = calc.GetPerimeter(square); Assert.AreEqual(expected, actual); }
public WeatherMachine(GeometricCalculator geometricCalculator, WeatherValidator weatherValidator) { this.geometricCalculator = geometricCalculator; this.weatherValidator = weatherValidator; OccurrencesByWeather.Add(WeatherType.Drought, 0); OccurrencesByWeather.Add(WeatherType.Rainy, 0); OccurrencesByWeather.Add(WeatherType.IdealConditions, 0); OccurrencesByWeather.Add(WeatherType.NotDefined, 0); }
public void GetPerimeterEmptyArray() { var calc = new GeometricCalculator(); float expected = 0f; var actual = calc.GetPerimeter(new GeometricThing[] { }); Assert.AreEqual(expected, actual); }
public void GetPerimeterOneNullArray() { var calc = new GeometricCalculator(); float expected = 70f; var actual = calc.GetPerimeter(new GeometricThing[] { new Geometry.Square(10), new Geometry.Rectangle(5, 10), new Geometry.Circle() }); Assert.AreEqual(expected, actual); }
public void GetPerimeterTest() { var objectArray = new GeometricThing[] { new Circle(12), new Triangle(2, 2), new Square(5) }; var geomatricCalculator = new GeometricCalculator(); Assert.AreEqual(101, MathF.Round(geomatricCalculator.GetPerimeter(objectArray))); }
public void GetAreaTestOnlyNegatives() { var calc = new GeometricCalculator(); float expected = 0f; var actual = calc.GetArea(new GeometricThing[] { new Geometry.Square(-630), new Geometry.Circle(-13.52314f), new Geometry.Rectangle(-20, -500), new Geometry.Triangle(-3000) }); Assert.AreEqual(expected, actual); }
public void GetAreaTestWeirdValues() { var calc = new GeometricCalculator(); float expected = 150f; // 100 + 0 + 0 + 50 = 150 var actual = calc.GetArea(new GeometricThing[] { new Geometry.Square(10), new Geometry.Circle(0), new Geometry.Rectangle(10, -20), new Geometry.Triangle(10) }); Assert.AreEqual(expected, actual); }
public void GetPerimeterManyNullValues() { var calc = new GeometricCalculator(); float expected = 40f; var actual = calc.GetPerimeter(new GeometricThing[] { new Geometry.Square(10), new Geometry.Triangle(), null, new Geometry.Circle(0) }); Assert.AreEqual(expected, actual); }
public void GetAreaTest() { var calc = new GeometricCalculator(); float expected = 428.53983f; // 100 + 78.53983 + 200 + 50 = 428.53983 var actual = calc.GetArea(new GeometricThing[] { new Geometry.Square(10), new Geometry.Circle(5), new Geometry.Rectangle(10, 20), new Geometry.Triangle(10) }); Assert.AreEqual(expected, actual); }
public void GetPerimeterTestWeirdValues() { var calc = new GeometricCalculator(); float expected = 70f; // 40 + 0 + 0 + 30 = 70 var actual = calc.GetPerimeter(new GeometricThing[] { new Geometry.Square(10), new Geometry.Circle(0), new Geometry.Rectangle(10, -20), new Geometry.Triangle(10) }); Assert.AreEqual(expected, actual); }
public void GetPerimeterTest() { var calc = new GeometricCalculator(); float expected = 161.41592f; // 40 + 31.41592 + 60 + 30 = 161.41592 var actual = calc.GetPerimeter(new GeometricThing[] { new Geometry.Square(10), new Geometry.Circle(5), new Geometry.Rectangle(10, 20), new Geometry.Triangle(10) }); Assert.AreEqual(expected, actual); }
public void GetPerimeterTest() { var geoCal = new GeometricCalculator(); var geoThings = new IGeometric[] { new Triangle(3, 4, 5), new Square(10), new Circle(3) }; var actual = geoCal.GetPerimeter(geoThings); var expected = 12 + 40 + 18.85; Assert.AreEqual(expected, actual, 0.01); }
public void GetCircumferenceTest0() { var calc = new GeometricCalculator(); var actual = calc.GetCircumference(new IGeometricThing[] { new Square(0.0f), new Circle(0.0f), new Rectangle(0, 0.0f), new Triangle(0) }); var expected = 0; Assert.AreEqual(expected, actual); }
public void GetCircumferenceTest() { var calc = new GeometricCalculator(); var actual = calc.GetCircumference(new IGeometricThing[] { new Square(10), new Circle(2), new Rectangle(2, 4), new Triangle(4) }); var expected = 40 + 6.2832f + 12 + 12; Assert.AreEqual(expected, actual); }
public IEnumerable <Individual> Cross(Individual individual1, Individual individual2) { var midpoint = GeometricCalculator.GetMidpoint(individual1.Semantics, individual2.Semantics); bool triedBackPropagation1; var child1 = GenerateChildren(individual1, individual2, midpoint, out triedBackPropagation1); bool triedBackPropagation2; var child2 = GenerateChildren(individual2, individual1, midpoint, out triedBackPropagation2); if (!triedBackPropagation1 && !triedBackPropagation2 && Fallback != null) { return(Fallback.Cross(individual1, individual2)); } return(new[] { child1, child2 }); }
static void Main(string[] args) { var initializer = new ConsoleDataInitializer(); var initializedResult = initializer.InitializeData(); if (initializedResult.IsSuccessful) { var calculator = new GeometricCalculator(initializedResult.Parameters.GeneralArea); Console.WriteLine(calculator.GetFullInfo()); } else { Console.WriteLine(initializedResult.ErrorMessage); } Console.ReadKey(); }
public static void Main(string[] args) { var calc = new GeometricCalculator(length: 10, numColumns: 12); var keys = calc.GenerateKeys(); foreach (var key in keys) { var vertices = calc.CalculateVerticesFromKey(key); PrintResult(key, vertices); var keyFromVertices = calc.CalculateKeyFromVertices(vertices); Console.Write($" Reverse={keyFromVertices}"); Console.WriteLine(); } Console.WriteLine("Hit any key to exit..."); Console.ReadKey(); }
public WeatherValidatorTest() { this.geometricCalculator = new GeometricCalculator(); this.weatherValidator = new WeatherValidator(geometricCalculator); }
public bool ContainsCoordinates(Vector2 coordinatesCenterOfFigure, Vector2 otherCoordinates) { return(GeometricCalculator.SquareContainsPoint(coordinatesCenterOfFigure, otherCoordinates, halfTileSize, tileArea)); }
public SquareTileCoordinateProcessor(float tileSize) { this.tileSize = tileSize; halfTileSize = tileSize / 2f; tileArea = GeometricCalculator.CalculateAreaOfSquare(tileSize); }
public bool ContainsCoordinates(Vector2 coordinatesCenterOfFigure, Vector2 otherCoordinates) { return(GeometricCalculator.CircleContainsPoint(coordinatesCenterOfFigure, otherCoordinates, radius)); }
public GeometricCalculatorTest() { geometricCalculator = new GeometricCalculator(); }
public WeatherValidator(GeometricCalculator geometricCalculator) { this.geometricCalculator = geometricCalculator; }