public void ExposeProvidedStatus([Values] EStormFuncInputState state) { var content = Mock.Of <IStormContent <object> >(); var sut = new StormFuncInput <object>(content, state); Assert.That(sut.VisitState, Is.EqualTo(state)); }
public void ExposeProvidedContent() { var content = Mock.Of <IStormContent <object> >(); var sut = new StormFuncInput <object>(content, EStormFuncInputState.NotVisited); Assert.That(sut.Content, Is.EqualTo(content)); }
private static decimal GetModelValue(StormFuncInput <decimal> meterValue, StormFuncInput <decimal> inchValue) { return((meterValue.VisitState, inchValue.VisitState) switch { (_, EStormFuncInputState.NotVisited) => meterValue.Content.GetValueOrThrow(), (EStormFuncInputState.NotVisited, _) => inchValue.Content.GetValueOrThrow(), _ => default });
public void ToStringCallContentToString() { var content = new Mock <IStormContent <object> >(MockBehavior.Strict); content.Setup(c => c.ToString()).Returns("test"); var s = new StormFuncInput <object>(content.Object, EStormFuncInputState.NotVisited).ToString(); Assert.That(s, Is.Not.Null); content.Verify(c => c.ToString(), Times.Once); }
protected sealed override bool Update() { try { var firstState = new StormFuncInput <TFirst>(First, GetState(0)); return(TrySetValue(_func(firstState))); } catch (StormError e) { return(TrySetError(e)); } catch (Exception e) { return(TrySetError(Error.Func.Evaluation(e))); } }
static int Func(StormFuncInput <int> firstInput) { return(42); }
public string ToString(IStormContent <object> content, EStormFuncInputState state) { var sut = new StormFuncInput <object>(content, state); return(sut.ToString()); }
private static string EvalF(StormFuncInput <int> firstState, StormFuncInput <int> secondState) { return($"First: {firstState}, Second: {secondState}"); }