예제 #1
0
        public void TestVersioningHelper_WhenReplacingDatePatternsShouldDoLongTimeShortDateAndShortTime()
        {
            const string testString = "$LTIME - $SDATE - $STIME";
            var testDate = new DateTime(2011, 9, 18, 1, 20, 34, 200);

            IBuildDetail buildDetail = new BuildDetailStub(99);

            string updatedValue = VersioningHelper.ReplacePatternsInPropertyValue(testString, buildDetail, 0, testDate);

            const string expectedResult = "1:20:34 AM - 9/18/2011 - 1:20 AM";

            Assert.AreEqual(expectedResult, updatedValue);
        }
예제 #2
0
        public void TestVersioningHelper_WhenReplacingPatternsShouldHandleBuildNameLabelAndRequesteBy()
        {
            const string testString = "$bname - $reqby";
            var testDate = new DateTime(2011, 9, 18, 1, 20, 34, 200);

            IBuildDetail buildDetail = new BuildDetailStub(99);

            string updatedValue = VersioningHelper.ReplacePatternsInPropertyValue(testString, buildDetail, 0, testDate);

            const string expectedResult = "Build Name - marknic";

            Assert.AreEqual(expectedResult, updatedValue);
        }
예제 #3
0
        public void TestVersioningHelper_WhenReplacingDatePatternsShouldDoUniversalLongDateAndShortDate()
        {
            const string testString = "$UTIME - $LDATE - $SDATE";
            var testDate = new DateTime(2011, 9, 18, 1, 20, 34, 200);

            IBuildDetail buildDetail = new BuildDetailStub(99);

            string updatedValue = VersioningHelper.ReplacePatternsInPropertyValue(testString, buildDetail, 0, testDate);

            const string expectedResult = "9/18/2011 6:20:34 AM - Sunday, September 18, 2011 - 9/18/2011";

            Assert.AreEqual(expectedResult, updatedValue);
        }
예제 #4
0
        public void TestVersioningHelper_WhenReplacingPatternsShouldWorkWithUpperOrLowerCase()
        {
            const string testString = "This is a test. Changing $YYYY and $b to their real values";
            var testDate = new DateTime(2011, 9, 18);

            IBuildDetail buildDetail = new BuildDetailStub(99);

            string updatedValue = VersioningHelper.ReplacePatternsInPropertyValue(testString, buildDetail, 0, testDate);

            var expectedResult = testString.Replace("$YYYY", "2011").Replace("$b", "99");

            Assert.AreEqual(expectedResult, updatedValue);
        }