public void Parse(string text, double expectedX, double expectedY, double expectedZ) { Assert.AreEqual(true, UnitVector3D.TryParse(text, out var p)); Assert.AreEqual(expectedX, p.X); Assert.AreEqual(expectedY, p.Y); Assert.AreEqual(expectedZ, p.Z); p = UnitVector3D.Parse(text); Assert.AreEqual(expectedX, p.X); Assert.AreEqual(expectedY, p.Y); Assert.AreEqual(expectedZ, p.Z); p = UnitVector3D.Parse(p.ToString()); Assert.AreEqual(expectedX, p.X); Assert.AreEqual(expectedY, p.Y); Assert.AreEqual(expectedZ, p.Z); }
public void ParseSwedishUnitVector(string text, double expectedX, double expectedY, double expectedZ) { var culture = CultureInfo.GetCultureInfo("sv"); Assert.AreEqual(true, UnitVector3D.TryParse(text, culture, out var p)); Assert.AreEqual(expectedX, p.X); Assert.AreEqual(expectedY, p.Y); Assert.AreEqual(expectedZ, p.Z); p = UnitVector3D.Parse(text, culture); Assert.AreEqual(expectedX, p.X); Assert.AreEqual(expectedY, p.Y); Assert.AreEqual(expectedZ, p.Z); p = UnitVector3D.Parse(p.ToString(culture)); Assert.AreEqual(expectedX, p.X); Assert.AreEqual(expectedY, p.Y); Assert.AreEqual(expectedZ, p.Z); }
public void ParseFails(string text) { Assert.AreEqual(false, UnitVector3D.TryParse(text, out _)); Assert.Throws <FormatException>(() => UnitVector3D.Parse(text)); }