public void Test_SysUtils() { #if __MonoCS__ Assert.IsTrue(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Unix, SysUtils.GetPlatformID()); Assert.IsFalse(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreNotEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #else Assert.IsFalse(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Win32NT, SysUtils.GetPlatformID()); Assert.IsTrue(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #endif // Assert.IsTrue(SysUtils.IsUnicodeEncoding(Encoding.UTF8)); Assert.IsFalse(SysUtils.IsUnicodeEncoding(Encoding.ASCII)); // Assembly asm = this.GetType().Assembly; var attr1 = SysUtils.GetAssemblyAttribute <AssemblyTitleAttribute>(asm); Assert.IsNotNull(attr1); Assert.AreEqual("GKTests", attr1.Title); Assert.Throws(typeof(ArgumentNullException), () => { SysUtils.GetAssemblyAttribute <AssemblyTitleAttribute>(null); }); }
public void Test_SysUtils() { #if __MonoCS__ Assert.IsTrue(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Unix, SysUtils.GetPlatformID()); Assert.IsFalse(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreNotEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #else Assert.IsFalse(SysUtils.IsUnix()); Assert.AreEqual(PlatformID.Win32NT, SysUtils.GetPlatformID()); Assert.IsTrue(string.IsNullOrEmpty(SysUtils.GetMonoVersion())); Assert.AreEqual(DesktopType.Windows, SysUtils.GetDesktopType()); #endif }