Skip to content

Instantly share code, notes, and snippets.

/// <summary> A DependencyObject extension method that gets injection service by enumerating the visual tree. </summary>
///
/// <remarks> Toeb, 2018-04-23. </remarks>
///
/// <param name="TargetObject"> . </param>
///
/// <returns> The injection service. </returns>
public static IInjectionService GetInjectionService(this DependencyObject TargetObject)
{
// needs to be extended to look at the views themselves
using Core.Common.Injection;
using Core.Common.MVVM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Data;
namespace Core.Common.Wpf.Export
using Core.Common.MVVM;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;
namespace Core.Common.Wpf.Export
{
using System;
using System.Windows.Markup;
using System.Windows.Data;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using Core.Common.Injection;
using System.Xml;
using System.Diagnostics;
Assert.AreEqual("~/", RelativePathUtility.Normalize(""));
Assert.AreEqual("~/", RelativePathUtility.Normalize("."));
Assert.AreEqual("~/", RelativePathUtility.Normalize("./"));
Assert.AreEqual("~/", RelativePathUtility.Normalize("/"));
Assert.AreEqual("~/", RelativePathUtility.Normalize("~/"));
Assert.AreEqual("~/test", RelativePathUtility.Normalize("test"));
Assert.AreEqual("~/test", RelativePathUtility.Normalize("./test"));
Assert.AreEqual("~/test/", RelativePathUtility.Normalize("./test/"));
Assert.AreEqual("~/test/test2", RelativePathUtility.Normalize("test/test2"));
/// concrete testclass implementing the abstract testclass bellow
[TestClass]
public class CoreFileSystemPhysicalReadonlyFileSystemTest : AbstractReadonlyFileSystemTest
{
protected override void CreateFile(string path, string content = "")
{
path = uut.NormalizePath(path);
using (var writer = new StreamWriter(File.OpenWrite(path)))
{