예제 #1
0
        public void Hops_Valid_NonEmpty()
        {
            Hops hops = new Hops();

            Mock <Hop> hop = GetMockHop();

            hop.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true);

            hops.Add(hop.Object);

            ValidationCode errorCode = ValidationCode.SUCCESS;

            // need to suppress the type check because moq uses a different type
            Assert.IsTrue(hops.IsValidRecordSet(ref errorCode, suppressTypeCheck: true));
        }
예제 #2
0
        public void Hops_Invalid_BadType()
        {
            Hops hops = new Hops();

            Mock <Hop> hop = GetMockHop();

            hop.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true);

            hops.Add(hop.Object);

            ValidationCode errorCode = ValidationCode.SUCCESS;

            // do not suppress type check. Since moq uses a different type anyway,
            // there is no need to test with a different IRecord type
            Assert.IsFalse(hops.IsValidRecordSet(ref errorCode, suppressTypeCheck: false));
        }