public void Parse_uses_parser_service(IParsesFraction parser, string fractionString, Fraction fraction) { Fraction.Parser = parser; Mock.Get(parser).Setup(x => x.Parse(fractionString)).Returns(fraction); Assert.That(() => Fraction.Parse(fractionString), Is.EqualTo(fraction)); }
/// <summary> /// Resets the internal services which are used by the <see cref="Fraction"/> class for /// parsing, simplification and formatting. /// </summary> internal static void ResetServices() { Parser = new FractionParser(); Simplifier = new FractionSimplifier(); Formatter = new FractionFormatter(Simplifier); }