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)); }
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)); }
/// <summary> /// Initializes a new instance of the <see cref="Recipe"/> class. /// </summary> /// <param name="type">The type.</param> /// <param name="style">The style.</param> /// <param name="brewer">The brewer.</param> /// <param name="batchSize">Size of the batch.</param> /// <param name="boilSize">Size of the boil.</param> /// <param name="boilTime">The boil time.</param> /// <param name="hops">The hops.</param> /// <param name="fermentables">The fermentables.</param> /// <param name="miscs">The miscs.</param> /// <param name="yeasts">The yeasts.</param> /// <param name="waters">The waters.</param> /// <param name="mash">The mash.</param> /// <param name="name">The name.</param> /// <param name="version">The version.</param> public Recipe( RecipeType type, Style style, string brewer, double batchSize, double boilSize, double boilTime, Hops hops, Fermentables fermentables, Miscs miscs, Yeasts yeasts, Waters waters, Mash mash, string name, int version = Constants.DEFAULT_BEER_XML_VERSION) : base(name, version) { Validation.ValidateGreaterThanZero(batchSize); Validation.ValidateGreaterThanZero(boilSize); Validation.ValidateGreaterThanZero(boilTime); Validation.ValidateNotNull(style); Validation.ValidateNotNull(hops); Validation.ValidateNotNull(fermentables); Validation.ValidateNotNull(miscs); Validation.ValidateNotNull(yeasts); Validation.ValidateNotNull(waters); Validation.ValidateNotNull(mash); this.Type = type; this.Style = style; this.Brewer = brewer; this.Batch_Size = batchSize; this.Boil_Size = boilSize; this.Boil_Time = boilTime; this.Hops = hops; this.Fermentables = fermentables; this.Miscs = miscs; this.Yeasts = yeasts; this.Waters = waters; this.Mash = mash; }
public void Yeasts_Valid_Empty() { Yeasts yeasts = new Yeasts(); Assert.IsTrue(yeasts.IsValid()); }