public BingLayer() { // Here we use a tile schema that is defined in code. There are a few predefined // tile schemas in the BruTile.dll. In the usual case the schema should be parsed // from a tile service description. schema = new BingSchema(); if (cache == null) { // Cache = new MemoryCache<byte[]>(1000, 100000); var localSettingsDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var assembly = Assembly.GetEntryAssembly(); if (assembly == null) { cache = new MemoryCache <byte[]>(1000, 100000); } else { var assemblyInfo = AssemblyUtils.GetAssemblyInfo(assembly); var cacheDirectoryPath = Path.Combine(Path.Combine(Path.Combine(localSettingsDirectoryPath, assemblyInfo.Company), assemblyInfo.Product), "cache_bing"); cache = new FileCache(cacheDirectoryPath, "jpg"); } } }
public void GetAssemblyInfo() { Assembly assembly = Assembly.GetExecutingAssembly(); AssemblyUtils.AssemblyInfo assemblyInfo = AssemblyUtils.GetAssemblyInfo(assembly); Assert.AreEqual("DelftTools.Tests", assemblyInfo.Title); }
public void GetAssemblyInfo_AssemblyNull_ThrowArgumentNullException() { // Call void Call() => AssemblyUtils.GetAssemblyInfo(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("assembly", exception.ParamName); }
public AboutWindow() { DataContext = this; Title = Constants.ABOUT_WINDOW_TITLE; InitializeComponent(); AssemblyName assemblyInfo = AssemblyUtils.GetAssemblyInfo(); AboutInformationText.Text = $"{assemblyInfo.Name} v{assemblyInfo.Version.Major}.{assemblyInfo.Version.Minor}.{assemblyInfo.Version.Build}"; UrlHyperlink.NavigateUri = AssemblyUtils.GetProjectUri(); UrlHyperlink.Inlines.Add(AssemblyUtils.GetProjectURL()); }
/// <summary> /// Asserts whether the <see cref="PersistableProjectInfo"/> contains the data /// that is representative for the <paramref name="calculation"/> /// and the <paramref name="filePath"/>. /// </summary> /// <param name="calculation">The calculation that contains the original data.</param> /// <param name="filePath">The file path that is used.</param> /// <param name="persistableProjectInfo">The <see cref="PersistableProjectInfo"/> that needs to be asserted.</param> /// <exception cref="AssertionException">Thrown when the data in <paramref name="persistableProjectInfo"/> /// is not correct.</exception> public static void AssertProjectInfo(MacroStabilityInwardsCalculation calculation, string filePath, PersistableProjectInfo persistableProjectInfo) { Assert.AreEqual(filePath, persistableProjectInfo.Path); Assert.AreEqual(calculation.Name, persistableProjectInfo.Project); Assert.AreEqual(calculation.InputParameters.SurfaceLine.Name, persistableProjectInfo.CrossSection); Assert.AreEqual($"Riskeer {AssemblyUtils.GetAssemblyInfo(Assembly.GetAssembly(typeof(PersistableDataModelTestHelper))).Version}", persistableProjectInfo.ApplicationCreated); Assert.AreEqual("Export from Riskeer", persistableProjectInfo.Remarks); Assert.IsNotNull(persistableProjectInfo.Created); Assert.IsNull(persistableProjectInfo.Date); Assert.IsNull(persistableProjectInfo.LastModified); Assert.IsNull(persistableProjectInfo.LastModifier); Assert.IsNull(persistableProjectInfo.Analyst); Assert.IsTrue(persistableProjectInfo.IsDataValidated); }
public void GetAssemblyInfo_ForThisTestProjectAssembly_ReturnAssemblyInfoWithExpectedValues() { // Setup var assembly = Assembly.GetAssembly(GetType()); // Call AssemblyUtils.AssemblyInfo assemblyInfo = AssemblyUtils.GetAssemblyInfo(assembly); // Assert Assert.AreEqual("Deltares", assemblyInfo.Company); Assert.AreEqual("Copyright © Deltares 2022", assemblyInfo.Copyright); Assert.AreEqual("Core.Common.Util.Test", assemblyInfo.Product); Assert.AreEqual("Core.Common.Util.Test", assemblyInfo.Title); StringAssert.StartsWith("22.2.1.1", assemblyInfo.Version); }
public static string GetApplicationLocalUserSettingsDirectory() { var localSettingsDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var executingAssembly = Assembly.GetExecutingAssembly(); var assemblyInfo = AssemblyUtils.GetAssemblyInfo(executingAssembly); var companySettingsDirectoryPath = Path.Combine(localSettingsDirectoryPath, assemblyInfo.Company); var appSettingsDirectoryPath = Path.Combine(companySettingsDirectoryPath, GetApplicationLocalUserSettingsDirectoryName()); if (!Directory.Exists(appSettingsDirectoryPath)) { Directory.CreateDirectory(appSettingsDirectoryPath); } return(appSettingsDirectoryPath); }
public void GetAssemblyInfo_LocationIsEmpty_ReturnEmptyAssemblyInfo() { // Setup var assemblyWithoutLocation = new MockedAssemblyWithoutLocation(); // Call AssemblyUtils.AssemblyInfo assemblyInfo = AssemblyUtils.GetAssemblyInfo(assemblyWithoutLocation); // Assert Assert.IsNull(assemblyInfo.Company); Assert.IsNull(assemblyInfo.Copyright); Assert.IsNull(assemblyInfo.Description); Assert.IsNull(assemblyInfo.Product); Assert.IsNull(assemblyInfo.Title); Assert.IsNull(assemblyInfo.Version); }
public void GetExecutingAssemblyInfo_ReturnAssemblyInfoForAssemblyUtilsAssembly() { // Setup var assembly = Assembly.GetAssembly(typeof(AssemblyUtils)); AssemblyUtils.AssemblyInfo assemblyInfo = AssemblyUtils.GetAssemblyInfo(assembly); // Call AssemblyUtils.AssemblyInfo executingAssemblyInfo = AssemblyUtils.GetExecutingAssemblyInfo(); // Assert Assert.AreEqual(assemblyInfo.Company, executingAssemblyInfo.Company); Assert.AreEqual(assemblyInfo.Copyright, executingAssemblyInfo.Copyright); Assert.AreEqual(assemblyInfo.Description, executingAssemblyInfo.Description); Assert.AreEqual(assemblyInfo.Product, executingAssemblyInfo.Product); Assert.AreEqual(assemblyInfo.Title, executingAssemblyInfo.Title); Assert.AreEqual(assemblyInfo.Version, executingAssemblyInfo.Version); }
/// <summary> /// Creates a new instance of <see cref="PersistableProjectInfo"/>. /// </summary> /// <param name="calculation">The calculation to use.</param> /// <param name="filePath">The file path to use.</param> /// <returns>A created <see cref="PersistableProjectInfo"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/> /// is <c>null</c>.</exception> public static PersistableProjectInfo Create(MacroStabilityInwardsCalculation calculation, string filePath) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } return(new PersistableProjectInfo { Path = filePath, Project = calculation.Name, CrossSection = calculation.InputParameters.SurfaceLine.Name, ApplicationCreated = string.Format(Resources.PersistableProjectInfoFactory_Create_Riskeer_Version_0, AssemblyUtils.GetAssemblyInfo(Assembly.GetAssembly(typeof(PersistableProjectInfoFactory))).Version), Remarks = Resources.PersistableProjectInfoFactory_Create_Export_from_Riskeer, Created = DateTime.Now, IsDataValidated = true }); }