예제 #1
0
 public void Init()
 {
     applicationReleaseConfiguration = Substitute.For <IApplicationReleaseConfiguration>();
     applicationReleaseConfiguration.GetString("BRANCH").Returns("master");
     applicationReleaseConfiguration.GetString("COMMIT").Returns("da5d17");
     applicationReleaseConfiguration.GetInt("BUILD_VERSION").Returns(12345);
 }
예제 #2
0
        public void TestNoBuild()
        {
            applicationReleaseConfiguration.GetInt("BUILD_VERSION").Returns((int?)null);

            var appVersion = new ApplicationVersion(applicationReleaseConfiguration);

            Assert.AreEqual(false, appVersion.VersionKnown);
        }
예제 #3
0
        public ApplicationVersion(IApplicationReleaseConfiguration appData)
        {
            var branch  = appData.GetString("BRANCH");
            var commit  = appData.GetString("COMMIT");
            var version = appData.GetInt("BUILD_VERSION");

            VersionKnown = branch != null && commit != null && version != null;
            Branch       = branch ?? "<no build data>";
            CommitHash   = commit ?? "<no build data>";
            BuildVersion = version ?? 0;
        }