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_GetAssemblyAttribute() { 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 static string GetAppCopyright() { var asm = GetAssembly(); if (asm == null) { return(string.Empty); } else { var attr = SysUtils.GetAssemblyAttribute <AssemblyCopyrightAttribute>(asm); return((attr == null) ? string.Empty : attr.Copyright); } }
public static string GetAppCopyright() { var attr = SysUtils.GetAssemblyAttribute <AssemblyCopyrightAttribute>(GetAssembly()); return((attr == null) ? string.Empty : attr.Copyright); }