public void ParseCorrectUnityVersions() { Assert.AreEqual(VersionParser.ParseUnityVersion("1.2.3f4"), new Version { Major = 1, Minor = 2, Patch = 3, Optional = 4 } ); Assert.AreEqual(VersionParser.ParseUnityVersion("5.6.1b1"), new Version { Major = 5, Minor = 6, Patch = 1, Optional = 1 } ); Assert.AreEqual(VersionParser.ParseUnityVersion("2017.1.0a3"), new Version { Major = 2017, Minor = 1, Patch = 0, Optional = 3 } ); }
//FIXME: Prepare proper version checker public virtual void CheckUnityVersion() { string environmentVersion = Application.unityVersion; if (VersionParser.ParseUnityVersion(environmentVersion) < VersionParser.ParseUnityVersion(UnityVersion)) { Debug.LogError(string.Format("Upfile.xml Unity Version ({0}) targets a higher version of Unity than you are currently using ({1})", UnityVersion, environmentVersion)); } }
public void DoNotParseUncorrectUnityVersions() { Assert.Throws <System.FormatException>( delegate { VersionParser.ParseUnityVersion("This should never be a Unity version"); } ); Assert.Throws <System.FormatException>( delegate { VersionParser.ParseUnityVersion("5.6f1"); } ); }