public void ReturnsOnlyEquivalencyForEqualValueRectangles() { //Arrange RectangleF rec1 = new RectangleF(0, 0, 10, 10); RectangleF rec2 = new RectangleF(0, 0, 10, 10); var processor = new RectangleProcessor(rec1, rec2); //Act var result = processor.GetAnalysis(); //Assert Assert.AreEqual("Rectangles are equivalent", result.GetSummary().Single()); }
public void ReturnsFiveOutcomesForDifferentValueRectangles() { //Arrange RectangleF rec1 = new RectangleF(0, 1, 10, 10); RectangleF rec2 = new RectangleF(0, 0, 10, 10); var processor = new RectangleProcessor(rec1, rec2); //Act var result = processor.GetAnalysis(); //Assert Assert.AreEqual(5, result.GetSummary().Count()); }
public ActionResult GetRectangleAnalysis(RectanglesFormViewModel model) { if (ModelState.IsValid) { var rectangle1 = new RectangleF(model.Rectangle1.X, model.Rectangle1.Y, model.Rectangle1.Width, model.Rectangle1.Height); var rectangle2 = new RectangleF(model.Rectangle2.X, model.Rectangle2.Y, model.Rectangle2.Width, model.Rectangle2.Height); var rectangleProcessor = new RectangleProcessor(rectangle1, rectangle2); return(PartialView(rectangleProcessor.GetAnalysis().GetSummary())); } else { return(new HttpStatusCodeResult(400)); } }