/// <summary> /// Sample. /// </summary> public TestClass() { // Send singleton object to any function that can take its interface. SiteStructure site = SiteStructure.Instance; CustomMethod(site); }
private iTool IdentifyTool() { iTool toolToExecute = new NOP(); switch (this.operation.ToLower()) { case "export security": toolToExecute = new ExportSecurity(); break; case "export alerts": toolToExecute = new ExportAlerts(); break; case "comparison report": toolToExecute = new ComparisonReport(); break; case "site structure": toolToExecute = new SiteStructure(); break; case "list report": toolToExecute = new ListReport(); break; } return(toolToExecute); }
public void Model_initialises_with_empty_state() { // Arrange / Act var model = new SiteStructure(); // Assert Assert.That(model, Is.Not.Null); Assert.That(model.ScriptUrls, Is.Empty); Assert.That(model.StyleUrls, Is.Empty); Assert.That(model.ContentItems, Is.Empty); }
public void Item_returns_empty_string_for_content_that_does_not_exist() { // Arrange var model = new SiteStructure(); // Act var html = model.Item(ContentTypes.HeaderWithMegaNav); // Assert Assert.That(html, Is.Not.Null); Assert.That(html.Length, Is.EqualTo(0)); }
public void Item_provides_access_to_content_by_type() { // Arrange var model = new SiteStructure(); model.ContentItems.Add(ContentTypes.HeaderWithMegaNav.ToString(), "<div id='header'></div>"); // Act var html = model.Item(ContentTypes.HeaderWithMegaNav); // Assert Assert.That(html, Is.Not.Null); }
public static SiteStructure GetInstance(string parameter) { if (_instance == null) { lock (_instance_Lock) { if (_instance == null) { _instance = new SiteStructure(parameter); } } } return(_instance); }
// Entry point into console application. static void Main() { // Constructor is protected -- cannot use new SiteStructure s1 = SiteStructure.Instance; SiteStructure s2 = SiteStructure.Instance; // Test for same instance if (s1 == s2) { Console.WriteLine("Objects are the same instance"); } // Wait for user Console.ReadKey(); }
private void AssertSlugIsNotTaken(CmsPage cmsPage, SitemapRelativePosition newSitemapRelativePosition) { ISiteStructureNode parentNode; if (Guid.Empty == newSitemapRelativePosition.ParentSitemapNodeId || cmsPage.SiteId == newSitemapRelativePosition.ParentSitemapNodeId) { parentNode = new SiteStructure(cmsPage.SiteId); } else { var findParentCondition = By.Condition($@"{nameof(CmsPageLocationNode.ContentId)} == {{{newSitemapRelativePosition.ParentSitemapNodeId}}}"); var sqlCondition = SqlTranslator.Build(findParentCondition, typeof(CmsPage)); var parentNodes = Orm.FindUnversionedContent <CmsPageLocationNode>(sqlCondition).Result; if (!parentNodes.Any()) { throw new Exception("Could not find a structual node for: '" + findParentCondition + "'"); } parentNode = parentNodes.Single(); } //var siblingsCondition = $@"{nameof(CmsPageLocationNode.PageId)} == {{{cmsPage.ContentEnvironment}}} && {nameof(CmsPageLocationNode.ParentNodeId)} == {{{parentNode.NodeId}}}"; //var sqlFilter =SqlFilter.FromEntityFilter(siblingsCondition, typeof(CmsPageLocationNode)); //var siblings = Orm.FindUnversionedContent<CmsPageLocationNode>(sqlFilter).Result.ToList(); //foreach (var sibling in siblings) //{ // this.FindContentVersions() //} //var dupSlugs = GetAllPages() // .Where(x => x.ParentPageId == cmsPage.ParentPageId && x.Id != cmsPage.Id) // .SelectMany(x => x.Routes) // .Where(x => x.Priority == (int) RoutePriority.Primary); //if (dupSlugs.Any()) // throw new DuplicateSlugException(); }
/// <summary> /// Create a new Site class given the a computer name, node number and two string arrays site Name and site prefix /// </summary> /// <param name="computerName">The host name of the machine</param> /// <param name="nodeNumber">The node number of the machine</param> /// <param name="siteName">The name of the site. Because there can be muliple sites (ie BB1,BB2), this is a string array</param> /// <param name="sitePrefix">The prefix of the site. Because there canb e multiple sites, this is a string array. The positions MUST MATCH the site Name</param> public static void createNewSite(string computerName, int nodeNumber, string[] siteName, string[] sitePrefix) { int temp = siteName.Length; for (int i = 0; i < temp; i++) { SiteStructure s = new SiteStructure(computerName, nodeNumber, siteName[i], sitePrefix[i]); //Oddly enough, I can't adccess Dictionary.TryAdd() method try { sitePrefixDict.Add(siteName[i], sitePrefix[i]); } catch (Exception e) { //Ignore exception } siteList.Add(s); } }
static void Main() { SiteStructure s = SiteStructure.Instance; }
/// <summary> /// Sample. /// </summary> public TestClass() { // Send singleton object to any function that can take its interface. SiteStructure site = new SiteStructure(); CustomMethod((ISiteInterface)site); }