public void ShouldLoadElement()
        {
            var locator = MockRepository.GenerateMock <IElementLocator>();
            var loader  = new ElementLoader(locator, false);

            locator.Stub(l => l.FindElement()).Return(_webElement);

            Expect(loader.Load(), Is.Not.Null);
            Expect(loader.Load(), Is.Not.Null);
        }
        public void ShouldCacheElement()
        {
            var locator = MockRepository.GenerateMock <IElementLocator>();
            var loader  = new ElementLoader(locator, true);

            locator.Stub(l => l.FindElement()).Return(_webElement).Repeat.Once();
            locator.Stub(l => l.FindElement()).Return(MockRepository.GenerateMock <IWebElement>());

            Expect(loader.Load(), Is.SameAs(loader.Load()));
            Expect(loader.Load(), Is.SameAs(_webElement));
        }
    private void SubstanceListHookup()
    {
        Hashtable substanceList = new Hashtable();

        ElementsAudio.Instance.LoadData(AsyncLoadManager <IGlobalAsyncLoader> .AsyncLoader <ElementAudioFileLoader> .Get().entries);
        ElementLoader.Load(ref substanceList, substanceTable);
        SubstanceTable = substanceTable;
    }
        public void ShouldIgnoreStaleElementReferenceException()
        {
            var locator = MockRepository.GenerateMock <IElementLocator>();
            var loader  = new ElementLoader(locator, true);

            locator.Stub(l => l.FindElement())
            .Throw(new StaleElementReferenceException("HOHOHO")).Repeat.Once();
            locator.Stub(l => l.FindElement()).Return(_webElement);

            Expect(loader.Load(), Is.Not.Null);
        }
Example #5
0
 public static void LoadElementsFile(string filename)
 {
     foreach (Element element in ElementLoader.Load(filename))
     {
         if (Elements.ContainsKey(element.Id))
         {
             Elements[element.Id] = element;
         }
         else
         {
             Elements.Add(element.Id, element);
         }
     }
 }