Beispiel #1
0
        public void Yeasts_Valid_NonEmpty()
        {
            Yeasts yeasts = new Yeasts();

            Mock <Yeast> yeast = GetMockYeast();

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

            yeasts.Add(yeast.Object);

            ValidationCode errorCode = ValidationCode.SUCCESS;

            // need to suppress the type check because moq uses a different type
            Assert.IsTrue(yeasts.IsValidRecordSet(ref errorCode, suppressTypeCheck: true));
        }
Beispiel #2
0
        public void Yeasts_Invalid_BadType()
        {
            Yeasts yeasts = new Yeasts();

            Mock <Yeast> yeast = GetMockYeast();

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

            yeasts.Add(yeast.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(yeasts.IsValidRecordSet(ref errorCode, suppressTypeCheck: false));
        }