public AlphaPopUpProcess(IAlphaPopUpProcessConstArg arg) : base(arg) { thisPopUp = arg.popUp; thisEngine = arg.engine; thisHides = arg.hides; thisPopUpAdaptor = thisPopUp.GetUIAdaptor(); }
public TestAlphaPopUpProcess( IAlphaPopUpProcessConstArg arg ) : base( arg ) { }
public IAlphaPopUpProcessConstArg CreateMockArg() { IAlphaPopUpProcessConstArg arg = Substitute.For <IAlphaPopUpProcessConstArg>(); arg.processManager.Returns(Substitute.For <IProcessManager>()); arg.processConstraint.Returns(ProcessConstraint.ExpireTime); arg.constraintValue.Returns(1f); arg.popUp.Returns(Substitute.For <IPopUp>()); arg.engine.Returns(Substitute.For <IPopUpStateEngine>()); arg.hides.Returns(false); return(arg); }
public void Expire_NotHides_CallsEngineSwitchToShownState() { IAlphaPopUpProcessConstArg arg = CreateMockArg(); IUIAdaptor uia = Substitute.For <IUIAdaptor>(); uia.GetGroupAlpha().Returns(0f); //required not to early break arg.popUp.GetUIAdaptor().Returns(uia); arg.hides.Returns(false); TestAlphaPopUpProcess process = new TestAlphaPopUpProcess(arg); process.Run();//required for interpolator set up process.Expire(); arg.engine.Received(1).SwitchToShownState(); }
public void GetLatestInitialValueDifference_ReturnsVarious( float curGroupAlpha, bool hides, float expected ) { IAlphaPopUpProcessConstArg arg = CreateMockArg(); arg.hides.Returns(hides); IUIAdaptor uia = Substitute.For <IUIAdaptor>(); uia.GetGroupAlpha().Returns(curGroupAlpha); arg.popUp.GetUIAdaptor().Returns(uia); TestAlphaPopUpProcess process = new TestAlphaPopUpProcess(arg); float actual = process.GetLatestInitialValueDifference_Test(); Assert.That(actual, Is.EqualTo(expected)); }