Пример #1
0
        public void AddNewRecordsetOutput_LastInput_IsNotNull_ShouldSet_Variable()
        {
            //---------------Set up test pack-------------------
            var serviceTestOutput = new ServiceTestOutput("[[Person().Name]]", "bob", "", "")
            {
                IsSearchCriteriaEnabled      = false,
                IsSinglematchCriteriaVisible = false
            };
            var testModel = new ServiceTestStep(Guid.NewGuid(), typeof(DsfDecision).Name, new ObservableCollection <IServiceTestOutput>()
            {
                serviceTestOutput
            }, StepType.Mock);
            var testModelObject = new PrivateObject(testModel);
            //---------------Assert Precondition----------------
            var ExpectedCount = testModel.StepOutputs.Count + 1;

            Assert.IsTrue(testModel.MockSelected);
            Assert.AreEqual(1, testModel.StepOutputs.Count);
            //---------------Execute Test ----------------------
            testModelObject.Invoke("AddNewRecordsetOutput", "[[Person(1).Name]]");
            //---------------Test Result -----------------------
            var countAfter = testModel.StepOutputs.Count;

            //---------------Test Result -----------------------
            Assert.AreEqual(ExpectedCount, countAfter);
        }
Пример #2
0
        public void AddNewRecordsetOutput_LastInput_IsNotNull_ShouldSet_Variable()
        {
            //---------------Set up test pack-------------------
            var serviceTestOutput = new ServiceTestOutput("[[Person().Name]]", "bob", "", "")
            {
                IsSearchCriteriaEnabled      = false,
                IsSingleMatchCriteriaVisible = false
            };
            var testModel = new ServiceTestStep(Guid.NewGuid(), typeof(DsfDecision).Name, new ObservableCollection <IServiceTestOutput>()
            {
                serviceTestOutput
            }, StepType.Mock);
            var methodInfo = testModel.GetType().GetMethod("AddNewRecordsetOutput", BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(string) }, null);

            //---------------Assert Precondition----------------
            Assert.IsNotNull(methodInfo, "Cannot get private method with reflection");
            var ExpectedCount = testModel.StepOutputs.Count + 1;

            Assert.IsTrue(testModel.MockSelected);
            Assert.AreEqual(1, testModel.StepOutputs.Count);
            //---------------Execute Test ----------------------
            methodInfo.Invoke(testModel, new[] { "[[Person(1).Name]]" });
            //---------------Test Result -----------------------
            var countAfter = testModel.StepOutputs.Count;

            //---------------Test Result -----------------------
            Assert.AreEqual(ExpectedCount, countAfter);
        }
Пример #3
0
        public void ServiceTestStep_EmptyStepOutputs_ShouldNotSetTestInvalid()
        {
            var serviceTestStep = new ServiceTestStep(Guid.NewGuid(), "", new ObservableCollection <IServiceTestOutput>(), StepType.Assert)
            {
                StepOutputs = new ObservableCollection <IServiceTestOutput>()
            };

            Assert.IsFalse(serviceTestStep.TestInvalid);
        }
Пример #4
0
        public void MockSelected_GivenIsTrue_ShouldSetUpCorrectly()
        {
            //---------------Set up test pack-------------------
            var serviceTestOutput = new ServiceTestOutput("a", "a", "", "");
            var testModel         = new ServiceTestStep(Guid.NewGuid(), typeof(DsfDecision).Name, new ObservableCollection <IServiceTestOutput>()
            {
                serviceTestOutput
            }, StepType.Mock);

            //---------------Assert Precondition----------------
            Assert.IsTrue(testModel.MockSelected);
            //---------------Execute Test ----------------------
            testModel.MockSelected = true;
            //---------------Test Result -----------------------
            Assert.AreEqual(false, serviceTestOutput.IsBetweenCriteriaVisible);
            Assert.AreEqual(true, serviceTestOutput.IsSingleMatchCriteriaVisible);
            Assert.AreEqual(true, serviceTestOutput.IsSearchCriteriaVisible);
        }
Пример #5
0
        public void AddNewRecordsetOutput_Sets_VariableName_Given_TestStep_Has_Empty_Variable()
        {
            //---------------Set up test pack-------------------
            var serviceTestOutput = new ServiceTestOutput("", "", "", "")
            {
                IsSearchCriteriaEnabled      = false,
                IsSinglematchCriteriaVisible = false
            };
            var testModel = new ServiceTestStep(Guid.NewGuid(), typeof(DsfDecision).Name, new ObservableCollection <IServiceTestOutput>()
            {
                serviceTestOutput
            }, StepType.Mock);
            var testModelObject = new PrivateObject(testModel);

            //---------------Assert Precondition----------------
            Assert.IsTrue(testModel.MockSelected);
            //---------------Execute Test ----------------------
            testModelObject.Invoke("AddNewRecordsetOutput", "[[Name]]");
            //---------------Test Result -----------------------
            Assert.AreEqual("[[Name]]", testModel.StepOutputs[0].Variable);
        }
Пример #6
0
        public void AddNewRecordsetOutput_Sets_VariableName_Given_TestStep_Has_Empty_Variable()
        {
            //---------------Set up test pack-------------------
            var serviceTestOutput = new ServiceTestOutput("", "", "", "")
            {
                IsSearchCriteriaEnabled      = false,
                IsSingleMatchCriteriaVisible = false
            };
            var testModel = new ServiceTestStep(Guid.NewGuid(), typeof(DsfDecision).Name, new ObservableCollection <IServiceTestOutput>()
            {
                serviceTestOutput
            }, StepType.Mock);
            var methodInfo = testModel.GetType().GetMethod("AddNewRecordsetOutput", BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(string) }, null);

            //---------------Assert Precondition----------------
            Assert.IsNotNull(methodInfo, "Cannot get private method with reflection");
            Assert.IsTrue(testModel.MockSelected);
            //---------------Execute Test ----------------------
            methodInfo.Invoke(testModel, new[] { "[[Name]]" });
            //---------------Test Result -----------------------
            Assert.AreEqual("[[Name]]", testModel.StepOutputs[0].Variable);
        }
Пример #7
0
        public void MockSelected_Given_IsSearchCriteriaEnabled()
        {
            //---------------Set up test pack-------------------
            var serviceTestOutput = new ServiceTestOutput("a", "a", "", "")
            {
                IsSearchCriteriaEnabled      = false,
                IsSinglematchCriteriaVisible = false
            };
            var testModel = new ServiceTestStep(Guid.NewGuid(), typeof(DsfDecision).Name, new ObservableCollection <IServiceTestOutput>()
            {
                serviceTestOutput
            }, StepType.Mock);

            //---------------Assert Precondition----------------
            Assert.IsTrue(testModel.MockSelected);
            //---------------Execute Test ----------------------
            testModel.MockSelected = true;
            //---------------Test Result -----------------------
            Assert.IsTrue(serviceTestOutput.IsSearchCriteriaEnabled);
            Assert.IsTrue(serviceTestOutput.IsSinglematchCriteriaVisible);
            Assert.IsFalse(serviceTestOutput.IsBetweenCriteriaVisible);
        }