public void SetEmptyCallSetError()
        {
            var input = new Mock <IStormInput <object> >(MockBehavior.Strict);

            input.Setup(i => i.SetError(It.IsAny <StormToken>(), Storm.Error.EmptyContent));
            StormExtensions.SetEmpty(input.Object);
        }
        public void SetErrorThrownOnEmptyMessage()
        {
            var input   = Mock.Of <IStormInput <object> >();
            var message = string.Empty;

            Assert.Throws <ArgumentException>(() => StormExtensions.SetError <object>(input, message));
        }
        public void SetErrorCallSetError()
        {
            const string message = "test";
            var          input   = new Mock <IStormInput <object> >(MockBehavior.Strict);

            input.Setup(i => i.SetError(It.IsAny <StormToken>(), It.Is <StormError>(e => e.Message == message)));
            StormExtensions.SetError(input.Object, message);
        }
        public void ConnectCallConnect()
        {
            var target = Mock.Of <IStorm <object> >();
            var input  = new Mock <IStormSocket <object> >(MockBehavior.Strict);

            input.Setup(i => i.Connect(It.IsAny <StormToken>(), target));
            StormExtensions.Connect(input.Object, target);
        }
        public void SetValueCallSetValue()
        {
            var value = new object();
            var input = new Mock <IStormInput <object> >(MockBehavior.Strict);

            input.Setup(i => i.SetValue(It.IsAny <StormToken>(), value));
            StormExtensions.SetValue(input.Object, value);
        }
示例#6
0
 public void MatchOnNullOnErrorThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.Match <object>(Mock.Of <IStormContent <object> >(), v => throw new Exception(), null));
 }
示例#7
0
 public void MatchOnNullContentThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.Match <object>(null, v => throw new Exception(), v => throw new Exception()));
 }
        public void SetValueDoNotThrowOnNullValue()
        {
            var input = Mock.Of <IStormInput <object> >();

            StormExtensions.SetValue(input, null);
        }
 public void SetValueThrownOnNullThisArgument()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.SetValue(null, new object()));
 }
        public void SetErrorThrownOnNullMessage()
        {
            var input = Mock.Of <IStormInput <object> >();

            Assert.Throws <ArgumentNullException>(() => StormExtensions.SetError <object>(input, null));
        }
        public void ConnectThrowOnNullTarget()
        {
            var socket = Mock.Of <IStormSocket <object> >();

            Assert.Throws <ArgumentNullException>(() => StormExtensions.Connect(socket, null));
        }
示例#12
0
 public void TryGetValueOnNullContentThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.TryGetValue <object>(null, out _));
 }
        public void ConnectThrownOnNullThisArgument()
        {
            var target = Mock.Of <IStorm <object> >();

            Assert.Throws <ArgumentNullException>(() => StormExtensions.Connect(null, target));
        }
 public void SetEmptyThrownOnNullThisArgument()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.SetEmpty <object>(null));
 }
示例#15
0
 public void SwitchWithCompare2WithNullSelectorThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.SwitchWithCompare(null, Mock.Of <IEqualityComparer <int> >()));
 }
示例#16
0
 public void SwitchWithoutCompare2Returns()
 {
     Assert.That(StormExtensions.SwitchWithoutCompare(Mock.Of <IStorm <IStorm <int> > >()), Is.Not.Null);
 }
示例#17
0
 public void SwitchWithoutCompareWithNullSelectorThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.SwitchWithoutCompare <int>(null));
 }
示例#18
0
 public void SwitchWithCompare2WithNullComparerThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.SwitchWithCompare(Mock.Of <IStorm <IStorm <int> > >(), null));
 }
示例#19
0
 public void GetValueOrThrowOnNullContentThrow()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.GetValueOrThrow <object>(null));
 }
 public void SetErrorThrownOnNullThisArgument()
 {
     Assert.Throws <ArgumentNullException>(() => StormExtensions.SetError <object>(null, "test"));
 }