public void Init() { applicationReleaseConfiguration = Substitute.For <IApplicationReleaseConfiguration>(); applicationReleaseConfiguration.GetString("BRANCH").Returns("master"); applicationReleaseConfiguration.GetString("COMMIT").Returns("da5d17"); applicationReleaseConfiguration.GetInt("BUILD_VERSION").Returns(12345); }
public void TestNoBuild() { applicationReleaseConfiguration.GetInt("BUILD_VERSION").Returns((int?)null); var appVersion = new ApplicationVersion(applicationReleaseConfiguration); Assert.AreEqual(false, appVersion.VersionKnown); }
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; }