public void NullBuildConfigurationWithFileTest() { var expected = false; var actual = ExclusionHandler.HasValidExclusions(null, "myfile.txt"); Assert.AreEqual(expected, actual); }
public void DoesNotReturnIncorrectExcludedItemsTest() { var path = Environment.CurrentDirectory; var xmlPath = string.Concat(path.Substring(0, path.IndexOf("bin")), "sample.xml"); var exclusions = ExclusionHandler.GetExcludedItems(xmlPath, "Test"); Assert.False(exclusions.Contains("sitecore\\content\\mysite\\donotexcludefrombuild1.item")); }
public void HasCorrectNumberOfExcludedItemsTest() { var expected = 3; var path = Environment.CurrentDirectory; var xmlPath = string.Concat(path.Substring(0, path.IndexOf("bin")), "sample.xml"); var exclusions = ExclusionHandler.GetExcludedItems(xmlPath, "Test"); Assert.AreEqual(expected, exclusions.Count); }
public void HasValidBuildConfigurationAndFileTest() { var expected = true; var path = Environment.CurrentDirectory; var xmlPath = string.Concat(path.Substring(0, path.IndexOf("bin")), "sample.xml"); var actual = ExclusionHandler.HasValidExclusions("myconfig", xmlPath); Assert.AreEqual(expected, actual); }
public void DoesNotReturnForConfigurationWithoutExclusionsTest() { var path = Environment.CurrentDirectory; var xmlPath = string.Concat(path.Substring(0, path.IndexOf("bin")), "sample.xml"); var configuration = "NO_RESULTS_CONFIGURATION"; var actual = ExclusionHandler.HasValidExclusions(configuration, xmlPath); Assert.True(actual); var exclusions = ExclusionHandler.GetExcludedItems(xmlPath, configuration); Assert.False(exclusions.Any()); }
public void ReturnsCorrectExcludedItemsTest() { var expected = new string[] { "sitecore\\content\\mysite\\excludefrombuild1.item", "sitecore\\content\\mysite\\excludefrombuild2.item", "sitecore\\content\\mysite\\excludefrombuild3.item" }; var path = Environment.CurrentDirectory; var xmlPath = string.Concat(path.Substring(0, path.IndexOf("bin")), "sample.xml"); var exclusions = ExclusionHandler.GetExcludedItems(xmlPath, "Test"); Assert.AreEqual(expected, exclusions); }
public void BuildConfigurationWithInvalidFilePathTest() { Assert.Throws <FileNotFoundException>(() => ExclusionHandler.HasValidExclusions("myconfig", "invalidfile.xml")); }
public void BuildConfigurationWithNoFilePathTest() { Assert.Throws <NullReferenceException>(() => ExclusionHandler.HasValidExclusions("myconfig", null)); }