public void DeserializeHop_InvalidResultIsNotValid() { MashStepType type = MashStepType.Decoction; string xml = $@" <MASH_STEP> <NAME>Conversion Step, 68C</NAME> <VERSION>1</VERSION> <TYPE>{EnumUtilities.ConvertEnumToString(type)}</TYPE> <STEP_TEMP>68.0</STEP_TEMP> <STEP_TIME>60.0</STEP_TIME> <INFUSE_AMOUNT>10.0</INFUSE_AMOUNT> </MASH_STEP>"; Mock <IStreamFactory> streamFactory = new Mock <IStreamFactory>(); using (MemoryStream ms = CommonUtilities.GetTestXmlStream(xml)) { streamFactory.Setup(f => f.GetFileStream(It.IsAny <string>(), It.IsAny <FileMode>())).Returns(ms); IBeerXMLSerializer s = new XDocumentBeerXMLSerializer() { StreamFactory = streamFactory.Object }; Mash_Step step = (Mash_Step)s.Deserialize(It.IsAny <string>()); Assert.IsFalse(step.IsValid()); } }
/// <summary> /// Initializes a new instance of the <see cref="Mash_Step"/> class. /// </summary> /// <param name="type">The type.</param> /// <param name="stepTemp">The step temporary.</param> /// <param name="stepTime">The step time.</param> /// <param name="name">The name.</param> /// <param name="version">The version.</param> public Mash_Step( MashStepType type, double stepTemp, double stepTime, string name, int version = Constants.DEFAULT_BEER_XML_VERSION) : base(name, version) { Validation.ValidateGreaterThanZero(stepTime); Validation.ValidateGreaterThanZero(stepTemp); this.Type = type; this.Step_Temp = stepTemp; this.Step_Time = stepTime; }