public void IRecordedCodeSequence_Constructor()
        {
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();

            //NUnit.Framework.Assert.NotNull(codeSequence.Items);
            Assert.IsNotNull(codeSequence.Items);
        }
Пример #2
0
        public void RecordWebItem_Null()
        {
            IRecordedCodeSequence result         = null;
            IRecordedCodeSequence codeSequence   = new RecordedCodeSequence();
            IRecordedCodeSequence expectedResult = codeSequence;
            IWebElement           element        = null;

            result =
                generateWebItem(
                    codeSequence,
                    element,
                    (new RecordedWebElement()));
            Assert.AreEqual(expectedResult, result);
        }
        public void RecordDataItem_DataCollection_Null()
        {
            IRecordedCodeSequence result       = null;
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();

            ReadOnlyCollection <object> dataCollection = null;
            IRecordedCodeSequence       expectedResult = codeSequence;

            result =
                generateDataItem(
                    codeSequence,
                    dataCollection,
                    (new RecordedData()));
            Assert.AreEqual(expectedResult, result);
        }
        public void CodeSequence_Empty()
        {
            IRecordedCodeSequence result       = null;
            string expectedResult              = Recorder.CodeGenElementClick;
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();
            IWebElement           element      = new FakeWebElement(Recorder.ConstAuxElementClicked, "");

            result =
                generateActionItem(
                    codeSequence,
                    element,
                    (new RecordedAction()));
            Assert.AreEqual(
                expectedResult,
                ((IRecordedActionItem)result.Items[result.Items.Count - 1]).UserData["code"]);
        }
Пример #5
0
        public void CheckCodeSequenceNovelty_RecordingCollection_Null_CodeSequence_Empty()
        {
            bool result                 = false;
            bool expectedResult         = false;
            TranscriptCmdletBase cmdlet = new TranscriptCmdletBase();

            Recorder.RecordingCollection = null;
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();

            result =
                Recorder.CheckCodeSequenceNovelty(
                    cmdlet,
                    Recorder.RecordingCollection,
                    codeSequence);
            Assert.AreEqual(expectedResult, result);
        }
Пример #6
0
        public void RecordCodeSequency_Non_Empty_CodeSequence_RecordedAction()
        {
            IRecordedCodeSequence codeSequence =
                new RecordedCodeSequence();

            codeSequence.Items.Add((new RecordedAction()));
            generateSequence(
                (new TranscriptCmdletBase()),
                (new System.Collections.Generic.List <IRecordedCodeSequence>()),
                codeSequence,
                (new FakeWebElement("recclicked", string.Empty)),
                null);

            Assert.AreEqual(
                Recorder.CodeGenElementClick,
                ((RecordedAction)Recorder.RecordingCollection[Recorder.RecordingCollection.Count - 1].Items[codeSequence.Items.Count - 1]).UserData["code"]);  // ?
        }
Пример #7
0
        public void Collection_Null()
        {
            System.Collections.Generic.List <IRecordedCodeSequence> recordings = null;
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();

            Recorder.StoreCodeSequenceInCollection(
                (new TranscriptCmdletBase()),
                recordings,
                codeSequence);


            //Assert.AreEqual(expectedResult, result.Items.Count);
//            Assert.AreEqual(
//                expectedResult,
//                ((RecordedData)Recorder.recordingCollection[Recorder.recordingCollection.Count - 1].Items[
//                    Recorder.recordingCollection[Recorder.recordingCollection.Count - 1].Items.Count - 1]).UserData["code"]);
            Assert.Fail("not implemented");
        }
Пример #8
0
        public void CheckCodeSequenceNovelty_RecordingCollection_Empty_CodeSequence_Non_Empty()
        {
            bool result                 = false;
            bool expectedResult         = true;
            TranscriptCmdletBase cmdlet = new TranscriptCmdletBase();

            Recorder.RecordingCollection =
                new System.Collections.Generic.List <IRecordedCodeSequence>();
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();

            codeSequence.Items.Add((new RecordedAction()));
            result =
                Recorder.CheckCodeSequenceNovelty(
                    cmdlet,
                    Recorder.RecordingCollection,
                    codeSequence);
            Assert.AreEqual(expectedResult, result);
        }
        public void RecordDataItem_DataCollection_Not_Empty()
        {
            IRecordedCodeSequence result       = null;
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();

            List <object> list =
                new List <object>();
            Dictionary <string, object> dict1 = new Dictionary <string, object>();

            dict1.Add("key1", "data1");
            list.Add(dict1);
            Dictionary <string, object> dict2 = new Dictionary <string, object>();

            dict2.Add("key2", "data2");
            list.Add(dict2);
            ReadOnlyCollection <object> dataCollection =
                new ReadOnlyCollection <object>(list);

            result =
                generateDataItem(
                    codeSequence,
                    dataCollection,
                    (new RecordedData()));
        }
Пример #10
0
        public void CheckCodeSequenceNovelty_CodeSequence_Duplicated()
        {
            bool result                 = false;
            bool expectedResult         = false;
            TranscriptCmdletBase cmdlet = new TranscriptCmdletBase();

            Recorder.RecordingCollection =
                new System.Collections.Generic.List <IRecordedCodeSequence>();
            IRecordedCodeSequence codeSequence = new RecordedCodeSequence();
            RecordedWebElement    webElement   = new RecordedWebElement();

            webElement.TagName = "button";
            codeSequence.Items.Add(webElement);
            RecordedAction action = new RecordedAction();

            action.UserData.Add("code", Recorder.CodeGenElementClick);
            codeSequence.Items.Add(action);

            Recorder.RecordingCollection.Add(codeSequence);

            // a new code sequence
            codeSequence       = new RecordedCodeSequence();
            webElement         = new RecordedWebElement();
            webElement.TagName = "button";
            codeSequence.Items.Add(webElement);
            action = new RecordedAction();
            action.UserData.Add("code", Recorder.CodeGenElementClick);
            codeSequence.Items.Add(action);

            result =
                Recorder.CheckCodeSequenceNovelty(
                    cmdlet,
                    Recorder.RecordingCollection,
                    codeSequence);
            Assert.AreEqual(expectedResult, result);
        }