public void ConvertVersionPattern_WhenUsingBuildPrefixShouldConvertIntoProperVersion()
        {
            var totalHours = (int)DateTime.Now.TimeOfDay.TotalHours;
            const int prefixVal = 100;

            // Create an instance of our test workflow
            var workflow = new Tests.ConvertVersionPatternTestWorkflow();

            // Create the workflow run-time environment
            var workflowInvoker = new WorkflowInvoker(workflow);

            workflowInvoker.Extensions.Add(new BuildDetailStub(totalHours));

            workflow.VersionPattern = "1.0.0.B";

            workflow.BuildNumberPrefix = prefixVal;

            // Invoke the workflow and capture the outputs
            var outputs = workflowInvoker.Invoke();

            // Retrieve the out arguments to do our verification
            var convertedVersionNumber = (String)outputs["ConvertedVersionNumber"];

            // Verify that we captured the version component of the build number
            Assert.AreEqual(string.Format("1.0.0.{0}", totalHours + prefixVal), convertedVersionNumber);
        }
        public void ConvertVersionPattern_WhenUsingBuildPrefixShouldThrowExceptionIfBuildNumberGreaterThanPrefix()
        {
            // Create an instance of our test workflow
            var workflow = new Tests.ConvertVersionPatternTestWorkflow();

            // Create the workflow run-time environment
            var workflowInvoker = new WorkflowInvoker(workflow);

            workflowInvoker.Extensions.Add(new BuildDetailStub(10));

            workflow.VersionPattern = "1.0.0.B";

            workflow.BuildNumberPrefix = 10;

            // Invoke the workflow and capture the outputs
            workflowInvoker.Invoke();
        }
        public void ConvertVersionPattern_WhenUsingMajorMinorJulianBuildShouldConvertIntoProperVersion()
        {
            var totalHours = (int)DateTime.Now.TimeOfDay.TotalHours;

            // Create an instance of our test workflow
            var workflow = new Tests.ConvertVersionPatternTestWorkflow();

            // Create the workflow run-time environment
            var workflowInvoker = new WorkflowInvoker(workflow);

            workflowInvoker.Extensions.Add(new BuildDetailStub(totalHours));

            workflow.VersionPattern = "1.2.J.B";

            // Invoke the workflow and capture the outputs
            var outputs = workflowInvoker.Invoke();

            // Retrieve the out arguments to do our verification
            var convertedVersionNumber = (String)outputs["ConvertedVersionNumber"];

            // Verify that we captured the version component of the build number
            Assert.AreEqual(string.Format("{0}.{1}.{2}.{3}", 1, 2,
                String.Format("{0}{1}", DateTime.Now.ToString("yy"), string.Format("{0:000}", DateTime.Now.DayOfYear)),
                Convert.ToInt16(totalHours)), convertedVersionNumber);
        }