public void LoadJSImportsTest() { string testData = "/path1/file1.js\n" + "path2/file2.js\n" + "/file3.js\n" + "#/comment1\n" + "\n" + //empty line " #comment2\n" + "\n"; byte[] testDataBuff = System.Text.Encoding.Default.GetBytes(testData); string pathPrefix = "~/JS/"; string[] expectedValues = new string[] { "~/JS/path1/file1.js", "~/JS/path2/file2.js", "~/JS/file3.js" }; IList <string> actual; Stream stream = new MemoryStream(testDataBuff); using (stream) { actual = JSImportReader_Accessor.LoadJSImports(stream, pathPrefix); } Assert.IsTrue(expectedValues.SequenceEqual <string>(actual)); }
public void GetPathPrefixTest_InvalidPath() { string given = "~"; string actual; actual = JSImportReader_Accessor.GetPathPrefix(given); Assert.Fail("Should have thrown ArgumentException."); }
public void GetPathPrefixTest_RootDir() { string given = "~/"; string expected = "~/"; string actual; actual = JSImportReader_Accessor.GetPathPrefix(given); Assert.AreEqual(expected, actual); }
public void GetPathPrefixTest_SubdirPath() { string given = "~/testdir/testfile"; string expected = "~/testdir/"; string actual; actual = JSImportReader_Accessor.GetPathPrefix(given); Assert.AreEqual(expected, actual); }