public void CalculateSplines_PositiveVector_Simple() { MockRepository mocks = new MockRepository(); ITargetingSystem targetingSystem = mocks.CreateMock<ITargetingSystem>(); using (mocks.Record()) { Expect.Call(targetingSystem.GeographicBias).Return(1.0); } using (mocks.Playback()) { FiringSolution firstSol = new FiringSolution(targetingSystem); firstSol.Vector = 1; FiringSolution result = firstSol.ReticulateSplines(1); Assert.That(result.Vector,Is.EqualTo(0.0)); } }
public void VectorCantBeZero() { MockRepository mocks = new MockRepository(); ITargetingSystem targetingSystem = mocks.CreateMock<ITargetingSystem>(); using (mocks.Record()) { // nothing to record - our mock won't get called } using (mocks.Playback()) { FiringSolution firstSol = new FiringSolution(targetingSystem); try { firstSol.Vector = 0; firstSol.ReticulateSplines(1); Assert.Fail("should have gotten an InvalidVectorException here"); } catch(InvalidVectorException) { // success } } }
/// <summary> /// Determine an appropriate firing solution to blow this target up /// </summary> /// <returns></returns> public FiringSolution ComputeFiringSolution() { FiringSolution current = new FiringSolution(this); // TEST // to compute a solution, first we have to access data written from the // ACHES-7529-MUX superprocessing mainframe - the only way we get // this information is by reading in a text file on the disk. // because of the way the software that accesses the mainframe works, the only // place this file can be written is C:\FiringSolution_Mainframe_Info.txt IList<double> precomputedVectors = ReadVectors(); foreach(double d in precomputedVectors) { current = current.ReticulateSplines(d); } return current; }