public Continuation Calculate(SuperInputCalcViewModel input) { var continuation = new Continuation(); var model = new SandCalcViewModel(); double sand = (1.0/3.0)*3.14*(Math.Pow(input.Diameter/2,2))*input.Height/27.0; model.TotalSand = Convert.ToDouble(Math.Round(Convert.ToDecimal(sand), 2)); continuation.Target = model; return continuation; }
public void Setup() { var given = new SuperInputCalcViewModel { Area = 261.67, Height = 10, Diameter = 10 }; _SUT = new SandCalculator(); _result = _SUT.Calculate(given); }
public Continuation Calculate(SuperInputCalcViewModel input) { var continuation = new Continuation(); var model = new OverseedBagsNeededCalcViewModel(); var field = _repository.Find<Field>(Int64.Parse(input.Field)); var inventoryProduct = _repository.Find<InventoryProduct>(Int64.Parse(input.Product)); decimal bagSizeInPounds = _unitSizeTimesQuantyCalculator.CalculateLbsPerUnit(inventoryProduct); double? bagsNeeded = ((input.SeedRate / (input.OverSeedPercent * .01)) * (Convert.ToDouble(field.Size / 1000))) / Convert.ToDouble(bagSizeInPounds); model.BagsNeeded = Convert.ToDouble(Math.Round(Convert.ToDecimal(bagsNeeded), 2)); model.BagSize = inventoryProduct.SizeOfUnit + " " + inventoryProduct.UnitType; model.FieldArea = field.Size.ToString(); continuation.Target = model; return continuation; }
public void Setup() { _field = ObjectMother.ValidField("raif").WithEntityId(1); _field.Size = 1000; var given = new SuperInputCalcViewModel { Field = _field.EntityId.ToString(), Depth = 10, DitchDepth = 10, DitchlineWidth = 10, Drainageline = 10, PipeRadius = 10 }; _repo = MockRepository.GenerateMock<IRepository>(); _repo.Expect(x => x.Find<Field>(Int64.Parse(given.Field))).Return(_field); _SUT = new MaterialsCalculator(_repo, null); _result = _SUT.Calculate(given); }
public void Setup() { _field = ObjectMother.ValidField("raif").WithEntityId(1); _field.Size = 1000; _product = ObjectMother.ValidInventoryProductFertilizer("poop").WithEntityId(2); _product.SizeOfUnit = 100; _product.UnitType = UnitType.Lbs.ToString(); var given = new SuperInputCalcViewModel { Field = _field.EntityId.ToString(), Product = _product.EntityId.ToString(), FertilizerRate = 100 }; _repo = MockRepository.GenerateMock<IRepository>(); _repo.Expect(x => x.Find<Field>(Int64.Parse(given.Field))).Return(_field); _repo.Expect(x => x.Find<InventoryProduct>(Int64.Parse(given.Product))).Return(_product); _SUT = new FertilizerNeededCalculator(_repo, new UnitSizeTimesQuantyCalculator(),null); _result = _SUT.Calculate(given); }
public Continuation Calculate(SuperInputCalcViewModel input) { var continuation = new Continuation(); var model = new MaterialsCalcViewModel(); var field = _repository.Find<Field>(Int64.Parse(input.Field)); double material = ((field.Size * (input.Depth / 12)) / 27) + (input.Drainageline * (input.DitchlineWidth / input.DitchDepth) / 27) - (3.14 * (input.PipeRadius / 12)*2 * input.Drainageline / 27); model.TotalMaterials = Convert.ToDouble(Math.Round(Convert.ToDecimal(material), 2)); model.FieldArea = field.Size; continuation.Target = model; //( // ( // 3.14 // *( // (tine diameter/2)/12 // )^2 // *(tine depth/12) // ) // *holes per sq. ft //) //*area return continuation; }