Exemplo n.º 1
0
        /// <summary>
        /// Used to add a test step to a test case at a specific stage of the test.
        /// </summary>
        ///
        /// <param name='testStep'>The test step to add to the test case.</param>
        /// <param name='stage'>The stage of the test case in which to add the test step</param>
        /// <param name='runConcurrently'>Specifies whether the test step
        /// should run concurrently to other test steps. Defaults to false if not specified.</param>
        /// <param name='failOnError'>Specifies whether the entire test case
        /// should fail if this individual test step fails, defaults to true if not specified.</param>
        public void AddTestStep(ITestStepOM testStep, TestStage stage, bool runConcurrently, bool failOnError)
        {
            ArgumentValidation.CheckForNullReference(testStep, "testStep");
            ArgumentValidation.CheckForNullReference(stage, "stage");

            AddTestStepInternal(new BizUnitTestStepWrapper(testStep, runConcurrently, failOnError), stage);
        }
Exemplo n.º 2
0
        /// <summary>
        /// TestStepBuilder constructor.
        /// </summary>
        /// 
        /// <param name='typeName'>The type name of the test step that will be 
        /// created by the TestStepBuilder, the step should implement ITestStepOM.</param>
        public TestStepBuilder(string typeName)
            : base(typeName)
        {
            ArgumentValidation.CheckForEmptyString(typeName, "typeName");

            _testStepOm = RawTestStep as ITestStepOM;
        }
Exemplo n.º 3
0
        /// <summary>
        /// TestStepBuilder constructor.
        /// </summary>
        ///
        /// <param name='typeName'>The type name of the test step that will be
        /// created by the TestStepBuilder, the step should implement ITestStepOM.</param>
        public TestStepBuilder(string typeName)
            : base(typeName)
        {
            ArgumentValidation.CheckForEmptyString(typeName, "typeName");

            _testStepOm = RawTestStep as ITestStepOM;
        }
Exemplo n.º 4
0
        /// <summary>
        /// TestStepBuilder constructor.
        /// </summary>
        ///
        /// <param name='typeName'>The type name of the test step that will be
        /// created by the TestStepBuilder, the step should implement ITestStepOM.</param>
        /// <param name='assemblyPath'>The assembly path of the test step that will be
        /// created by the TestStepBuilder, the step should implement ITestStepOM.</param>
        public TestStepBuilder(string typeName, string assemblyPath)
            : base(typeName, assemblyPath)
        {
            ArgumentValidation.CheckForEmptyString(typeName, "typeName");
            // assemblyPath - optional

            _testStepOm = RawTestStep as ITestStepOM;
        }
Exemplo n.º 5
0
        internal BizUnitTestStepWrapper(ITestStepOM testStep, bool runConcurrently, bool failOnError)
        {
            ArgumentValidation.CheckForNullReference(testStep, "testStep");

            _testStepBuilder = new TestStepBuilder(testStep);
            RunConcurrently  = runConcurrently;
            _failOnError     = failOnError;
            TypeName         = testStep.GetType().ToString();
        }
Exemplo n.º 6
0
 internal BizUnitTestStepWrapper(ITestStepOM testStep, bool runConcurrently, bool failOnError)
 {
     ArgumentValidation.CheckForNullReference(testStep, "testStep");
     
     _testStepBuilder = new TestStepBuilder(testStep);
     RunConcurrently = runConcurrently;
     FailOnError = failOnError;
     TypeName = testStep.GetType().ToString();
 }
Exemplo n.º 7
0
        public void TestDisposeWithSteps()
        {
            Context context = new Context();

            context.DisposeMembersOnTestCaseCompletion = true;
            IDisposable disposable    = mockery.DynamicMock <IDisposable>();
            IEnumerable notDisposable = mockery.DynamicMock <IEnumerable>();

            context.Add("DisposableClassKey", disposable);
            context.Add("NotDisposableClassKey", notDisposable);

            BizUnitTestCase testCase  = new BizUnitTestCase("TestDisposeWithSteps");
            ITestStepOM     mockStep1 = mockery.DynamicMock <ITestStepOM>();

            testCase.AddTestStep(mockStep1, TestStage.Setup);
            ITestStepOM mockStep2 = mockery.DynamicMock <ITestStepOM>();

            testCase.AddTestStep(mockStep2, TestStage.Execution);
            ITestStepOM mockStep3 = mockery.DynamicMock <ITestStepOM>();

            testCase.AddTestStep(mockStep3, TestStage.Cleanup);

            using (mockery.Record())
            {
                mockStep1.Execute(context);
                LastCall.Repeat.Once();

                mockStep2.Execute(context);
                LastCall.Repeat.Once();

                mockStep3.Execute(context);
                LastCall.Repeat.Once();

                disposable.Dispose();
                LastCall.Repeat.Once();
            }

            using (mockery.Playback())
            {
                BizUnit.BizUnit bizUnit = new BizUnit.BizUnit(testCase, context);
                bizUnit.RunTest();
            }
        }
Exemplo n.º 8
0
        public void DBExecuteNonQueryStep_Create()
        {
            const string ConnectionString     = "FooBar";
            const int    DelayBeforeExecution = 3;
            const int    NumberOfRowsAffected = 5;

            TestStepBuilder tsb = new TestStepBuilder("BizUnit.DBExecuteNonQueryStep", null);

            object[] args = new object[1];
            args[0] = ConnectionString;
            tsb.SetProperty("ConnectionString", args);

            args    = new object[1];
            args[0] = DelayBeforeExecution;
            tsb.SetProperty("DelayBeforeExecution", args);

            args    = new object[1];
            args[0] = NumberOfRowsAffected;
            tsb.SetProperty("NumberOfRowsAffected", args);

            args    = new object[3];
            args[0] = "INSERT INTO TABLE (COLUMN1, COLUMN2) VALUES (VALUE1, {0},{1})";
            args[1] = "Foo";
            args[2] = (Int32)32;
            tsb.SetProperty("SQLQuery", args);


            Context     context  = new Context();
            ITestStepOM testStep = tsb.TestStepOM;

            testStep.Validate(context);

            DBExecuteNonQueryStep dbe = testStep as DBExecuteNonQueryStep;

            Assert.IsNotNull(dbe);
            Assert.AreEqual(dbe.ConnectionString, ConnectionString);
            Assert.AreEqual(dbe.DelayBeforeExecution, DelayBeforeExecution);
            Assert.AreEqual(dbe.NumberOfRowsAffected, NumberOfRowsAffected);
            Assert.AreEqual(dbe.SQLQuery.GetFormattedSqlQuery(),
                            "INSERT INTO TABLE (COLUMN1, COLUMN2) VALUES (VALUE1, Foo,32)");
        }
Exemplo n.º 9
0
 /// <summary>
 /// Used to add a test step to a test case at a specific stage of the test.
 /// </summary>
 ///
 /// <param name='testStep'>The test step to add to the test case.</param>
 /// <param name='stage'>The stage of the test case in which to add the test step</param>
 public void AddTestStep(ITestStepOM testStep, TestStage stage)
 {
     AddTestStep(testStep, stage, false, true);
 }
Exemplo n.º 10
0
        /// <summary>
        /// Used to add a test step to a test case at a specific stage of the test.
        /// </summary>
        /// 
        /// <param name='testStep'>The test step to add to the test case.</param>
        /// <param name='stage'>The stage of the test case in which to add the test step</param>
        /// <param name='runConcurrently'>Specifies whether the test step 
        /// should run concurrently to other test steps. Defaults to false if not specified.</param>
        /// <param name='failOnError'>Specifies whether the entire test case 
        /// should fail if this individual test step fails, defaults to true if not specified.</param>
        public void AddTestStep(ITestStepOM testStep, TestStage stage, bool runConcurrently, bool failOnError)
        {
            ArgumentValidation.CheckForNullReference(testStep, "testStep");
            ArgumentValidation.CheckForNullReference(stage, "stage");

            AddTestStepInternal(new BizUnitTestStepWrapper(testStep, runConcurrently, failOnError), stage);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Used to add a test step to a test case at a specific stage of the test.
 /// </summary>
 /// 
 /// <param name='testStep'>The test step to add to the test case.</param>
 /// <param name='stage'>The stage of the test case in which to add the test step</param>
 public void AddTestStep(ITestStepOM testStep, TestStage stage)
 {
     AddTestStep(testStep, stage, false, true);
 }
Exemplo n.º 12
0
        /// <summary>
        /// TestStepBuilder constructor.
        /// </summary>
        ///
        /// <param name='testStep'>A test step that has already been created and
        /// that implements ITestStepOM.</param>
        public TestStepBuilder(ITestStepOM testStep)
        {
            ArgumentValidation.CheckForNullReference(testStep, "testStep");

            _testStepOm = testStep;
        }
Exemplo n.º 13
0
        /// <summary>
        /// TestStepBuilder constructor.
        /// </summary>
        /// 
        /// <param name='typeName'>The type name of the test step that will be 
        /// created by the TestStepBuilder, the step should implement ITestStepOM.</param>
        /// <param name='assemblyPath'>The assembly path of the test step that will be 
        /// created by the TestStepBuilder, the step should implement ITestStepOM.</param>
        public TestStepBuilder(string typeName, string assemblyPath)
            : base(typeName, assemblyPath)
        {
            ArgumentValidation.CheckForEmptyString(typeName, "typeName");
            // assemblyPath - optional

            _testStepOm = RawTestStep as ITestStepOM;
        }
Exemplo n.º 14
0
        /// <summary>
        /// TestStepBuilder constructor.
        /// </summary>
        /// 
        /// <param name='testStep'>A test step that has already been created and 
        /// that implements ITestStepOM.</param>
        public TestStepBuilder(ITestStepOM testStep)
        {
            ArgumentValidation.CheckForNullReference(testStep, "testStep");

            _testStepOm = testStep;
        }