Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public void ExposeProvidedContent()
        {
            var content = Mock.Of <IStormContent <object> >();
            var sut     = new StormFuncInput <object>(content, EStormFuncInputState.NotVisited);

            Assert.That(sut.Content, Is.EqualTo(content));
        }
Exemplo n.º 3
0
 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
     });
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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)));
            }
        }
Exemplo n.º 6
0
 static int Func(StormFuncInput <int> firstInput)
 {
     return(42);
 }
Exemplo n.º 7
0
        public string ToString(IStormContent <object> content, EStormFuncInputState state)
        {
            var sut = new StormFuncInput <object>(content, state);

            return(sut.ToString());
        }
Exemplo n.º 8
0
 private static string EvalF(StormFuncInput <int> firstState,
                             StormFuncInput <int> secondState)
 {
     return($"First: {firstState}, Second: {secondState}");
 }