public void UpdateProcess_CallsIrperInterpolate(float expireT) { IInterpolatorProcesssConstArg arg = CreateMockArg(); arg.constraintValue.Returns(expireT); TestInterpolatorProcess testProcess = new TestInterpolatorProcess(arg); testProcess.Run(); IInterpolator irper = testProcess.GetInterpolator(); irper.Received(1).Interpolate(0f); IProcessManager processManager = arg.processManager; const float deltaT = .1f; for (float f = deltaT; f < expireT; f += deltaT) { float elapsedT = f; testProcess.UpdateProcess(deltaT); irper.Received(1).Interpolate(elapsedT / expireT); processManager.DidNotReceive().RemoveRunningProcess(testProcess); } testProcess.UpdateProcess(deltaT); irper.Received(1).Interpolate(1f); processManager.Received(1).RemoveRunningProcess(testProcess); }
public TestInterpolatorProcess( IInterpolatorProcesssConstArg arg ) : base( arg ) { }
public AbsInterpolatorProcess( IInterpolatorProcesssConstArg arg ) : base( arg ) { thisUseSpringT = arg.useSpringT; }
public IInterpolatorProcesssConstArg CreateMockArg() { IInterpolatorProcesssConstArg arg = Substitute.For <IInterpolatorProcesssConstArg>(); arg.processManager.Returns(Substitute.For <IProcessManager>()); arg.processConstraint.Returns(ProcessConstraint.ExpireTime); arg.constraintValue.Returns(1f); arg.useSpringT.Returns(false); return(arg); }
public void Run_CallsIrperInterpolateWithZero() { IInterpolatorProcesssConstArg arg = CreateMockArg(); TestInterpolatorProcess testProcess = new TestInterpolatorProcess(arg); testProcess.Run(); IInterpolator irper = testProcess.GetInterpolator(); irper.Received(1).Interpolate(0f); }