public void Fermentables_Valid_NonEmpty() { Fermentables fermentables = new Fermentables(); Mock <Fermentable> fermentable = GetMockFermentable(); fermentable.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true); fermentables.Add(fermentable.Object); ValidationCode errorCode = ValidationCode.SUCCESS; // need to suppress the type check because moq uses a different type Assert.IsTrue(fermentables.IsValidRecordSet(ref errorCode, suppressTypeCheck: true)); }
public void Fermentables_Invalid_BadType() { Fermentables fermentables = new Fermentables(); Mock <Fermentable> fermentable = GetMockFermentable(); fermentable.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true); fermentables.Add(fermentable.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(fermentables.IsValidRecordSet(ref errorCode, suppressTypeCheck: false)); }