Пример #1
0
 /// <summary>
 /// Convert the <see cref="ForcemainEquation"/> back into an inp string
 /// </summary>
 /// <param name="forcemainEquation">The forcemain equation that will be converted</param>
 /// <exception cref="InpParseException">Throws if an inhandled
 /// value is attemped to be converted</exception>
 /// <returns>Returns: A valid inp string from the value of the forcemain equation</returns>
 public static string ToInpString(this ForcemainEquation forcemainEquation) => forcemainEquation switch
 {
 public void ToInpString_ValidString_ShouldMatchValue(string expectedValue, ForcemainEquation equation)
 => Assert.Equal(PruneInpString(expectedValue, OptionsHeader), new ForcemainEquationOption(equation).ToInpString());
Пример #3
0
 /// <summary>
 /// Convert an inp <see cref="string"/> to a <see cref="ForcemainEquation"/>
 /// </summary>
 /// <param name="forcemainEquation">The <see cref="ForcemainEquation"/> that the extension
 /// will base off of</param>
 /// <param name="inpString">The <see cref="string"/> that will be converted</param>
 /// <exception cref="InpParseException">
 /// Thrown if an unhandled value for the string is passed
 /// </exception>
 /// <returns>Returns: a <see cref="ForcemainEquation"/> that corresponds to the
 /// correct inp string value</returns>
 public static ForcemainEquation FromInpString(this ForcemainEquation forcemainEquation,
                                               string inpString) => inpString switch
 {
     "D-W" => ForcemainEquation.DarcyWeisbach,
 public void ParseTests_ValidString_ShouldMatchValue(string inpString, ForcemainEquation expectedValue)
 => Assert.Equal(expectedValue, SetupProject(inpString).Database.GetOption <ForcemainEquationOption>().Value);