コード例 #1
0
        public void IfEmpty_WithFull_DoNotCallAction_ReturnEmpty()
        {
            var target = new MockClass1();

            var result = _sequenceFull.IfEnumEmpty(() => { Assert.Fail(); target.MethodReturnVoid(); });

            Assert.AreSame(result, _sequenceFull);
        }
コード例 #2
0
        public void IfEmpty_WithEmpty_CallAction_ReturnEmpty()
        {
            var target = new MockClass1();

            IEnumerable <string> result = _sequenceEmpty.IfEnumEmpty(() => target.MethodReturnVoid());

            Assert.IsFalse(result.Any());
            Assert.IsTrue(target.SomeMethodCalled);
        }
コード例 #3
0
        public void IfNotEmpty_WithFull_DoNotCallAction_ReturnNull()
        {
            var target = new MockClass1();

            var result = _sequenceFull.IfEnumNotEmpty(x => target.MethodReturnVoid());

            Assert.IsTrue(target.SomeMethodCalled);
            Assert.AreSame(result, _sequenceFull);
        }
コード例 #4
0
        public void IfNotNull_WithTarget_CallAction_ReturnSameType()
        {
            var target = new MockClass1();

            var rtn = target.IfNotNull(() => target.MethodReturnVoid());

            Assert.IsNotNull(rtn);
            Assert.AreSame(rtn, target);
            Assert.IsTrue(target.SomeMethodCalled);
        }
コード例 #5
0
        public void IfNotEmpty_WithString_CallActionString()
        {
            const string target   = "a";
            var          someType = new MockClass1();

            var result = target.IfNotEmpty(x => someType.MethodReturnVoid());

            Assert.AreEqual(result, target);
            Assert.IsTrue(someType.SomeMethodCalled);
        }