private Mock <Mash> GetMockMash() { Mash_Steps steps = new Mash_Steps(); return(new Mock <Mash>( 70.0, steps, "Empty", 1)); }
public void Mash_EmptySteps_Valid() { Mash_Steps steps = new Mash_Steps(); Mash mash = new Mash( 70, steps, "Empty"); Assert.IsTrue(mash.IsValid()); }
/// <summary> /// Initializes a new instance of the <see cref="Mash"/> class. /// </summary> /// <param name="grainTemp">The grain temporary.</param> /// <param name="mashSteps">The mash steps.</param> /// <param name="name">The name.</param> /// <param name="version">The version.</param> public Mash( double grainTemp, Mash_Steps mashSteps, string name, int version = Constants.DEFAULT_BEER_XML_VERSION) : base(name, version) { Validation.ValidateGreaterThanZero(grainTemp); Validation.ValidateNotNull(mashSteps); this.Grain_Temp = grainTemp; this.Mash_Steps = mashSteps; }
public void Mash_EmptySteps_Valid_ErrorCode() { Mash_Steps steps = new Mash_Steps(); Mash mash = new Mash( 70, steps, "Empty"); ValidationCode errorCode = ValidationCode.SUCCESS; mash.IsValid(ref errorCode); Assert.AreEqual(ValidationCode.SUCCESS, errorCode); }
public void Mash_Steps_Valid_NonEmpty() { Mash_Steps mash_Steps = new Mash_Steps(); Mock <Mash_Step> mash_Step = GetMockMash_Step(); mash_Step.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true); mash_Steps.Add(mash_Step.Object); ValidationCode errorCode = ValidationCode.SUCCESS; // need to suppress the type check because moq uses a different type Assert.IsTrue(mash_Steps.IsValidRecordSet(ref errorCode, suppressTypeCheck: true)); }
public void Mash_Steps_Invalid_BadType() { Mash_Steps mash_Steps = new Mash_Steps(); Mock <Mash_Step> mash_Step = GetMockMash_Step(); mash_Step.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true); mash_Steps.Add(mash_Step.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(mash_Steps.IsValidRecordSet(ref errorCode, suppressTypeCheck: false)); }
public void Mash_Steps_Valid_Empty() { Mash_Steps mash_Steps = new Mash_Steps(); Assert.IsTrue(mash_Steps.IsValid()); }