/* * Karinto Library Project * * This software is distributed under a zlib-style license. * See license.txt for more information. */ using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Reflection; using System.Text.RegularExpressions; using Karinto; using NUnit.Framework; namespace KarintoTest { [TestFixture] public class FilePathTest { [Test] public void FileWithoutDirectory() { FilePath path = new FilePath("karinto.test"); Assert.AreEqual("karinto", path.BaseName); Assert.AreEqual(".test", path.Extension); FilePath.WorkDirectory = System.IO.Path.GetTempPath(); } [Test] public void AbsolutePath() { string exePath = Assembly.GetExecutingAssembly().Location; FilePath path = new FilePath(exePath); Assert.AreEqual("KarintoTest", path.BaseName); Assert.AreEqual(".dll", path.Extension.ToLower()); Assert.IsNotNull(path.Directory); Regex outDir = new Regex(@"[/\\]KarintoTest[/\\]bin[/\\]", RegexOptions.IgnoreCase); Assert.IsTrue(outDir.Match(path.Directory).Success); } } }