public void TestIsDefaultVersion_True() { GcpPublishStepsUtils.NowOverride = DateTime.Parse("2010-10-10 10:10:10"); Assert.IsTrue(GcpPublishStepsUtils.IsDefaultVersion(GcpPublishStepsUtils.GetDefaultVersion())); Assert.IsTrue(GcpPublishStepsUtils.IsDefaultVersion("12345678t123456")); }
public void TestIncrementVersion_HandlesNull() { GcpPublishStepsUtils.NowOverride = DateTime.Parse("2023-10-10 10:10:10"); string result = GcpPublishStepsUtils.IncrementVersion(null); Assert.AreEqual(GcpPublishStepsUtils.GetDefaultVersion(), result); }
public DeploymentOptions(string service, string version, bool promote, bool openWebsite, string configuration) { Service = service; Version = version ?? GcpPublishStepsUtils.GetDefaultVersion(); Promote = promote; OpenWebsite = openWebsite; Configuration = configuration; Context = new GCloudContext(); }
public void TestInitialState() { Assert.AreEqual(GcpPublishStepsUtils.GetDefaultVersion(), _objectUnderTest.Version); Assert.IsFalse(_objectUnderTest.NeedsAppCreated); Assert.IsFalse(_objectUnderTest.SetAppRegionCommand.CanExecuteCommand); Assert.IsFalse(_objectUnderTest.ShowInputControls); Assert.IsTrue(_objectUnderTest.Promote); Assert.IsTrue(_objectUnderTest.OpenWebsite); }
public override void OnPushedToDialog(IPublishDialog dialog) { _publishDialog = dialog; DeploymentName = _publishDialog.Project.Name.ToLower(); DeploymentVersion = GcpPublishStepsUtils.GetDefaultVersion(); // Mark that the dialog is going to be busy until we have loaded the data. _publishDialog.TrackTask(Clusters.ValueTask); }
public void TestIncrementVersion_ReplacesDefaultVersion() { GcpPublishStepsUtils.NowOverride = DateTime.Parse("2011-11-11 01:01:01"); string initalVersion = GcpPublishStepsUtils.GetDefaultVersion(); GcpPublishStepsUtils.NowOverride = DateTime.Parse("2012-12-12 02:02:02"); string result = GcpPublishStepsUtils.IncrementVersion(initalVersion); Assert.AreEqual(GcpPublishStepsUtils.GetDefaultVersion(), result); }
public void TestInitialState() { CollectionAssert.That.IsEmpty(_objectUnderTest.Clusters); Assert.IsNull(_objectUnderTest.SelectedCluster); Assert.IsNull(_objectUnderTest.DeploymentName); Assert.AreEqual(GcpPublishStepsUtils.GetDefaultVersion(), _objectUnderTest.DeploymentVersion); Assert.AreEqual(GkeStepViewModel.ReplicasDefaultValue, _objectUnderTest.Replicas); Assert.IsFalse(_objectUnderTest.ExposeService); Assert.IsFalse(_objectUnderTest.ExposePublicService); Assert.IsFalse(_objectUnderTest.OpenWebsite); Assert.IsFalse(_objectUnderTest.CreateClusterCommand.CanExecuteCommand); Assert.IsFalse(_objectUnderTest.RefreshClustersListCommand.CanExecuteCommand); }
public void TestLoadProjectProperties_SetsVersionToDefaultOnEmptyNextVersionProperty() { GcpPublishStepsUtils.NowOverride = DateTime.Parse("2008-08-08 08:08:08"); const string nextVersionProperty = " "; _propertyServiceMock .Setup(s => s.GetUserProperty(_mockedProject, FlexStepViewModel.NextVersionProjectPropertyName)) .Returns(nextVersionProperty); _objectUnderTest.OnVisible(); Assert.AreEqual(GcpPublishStepsUtils.GetDefaultVersion(), _objectUnderTest.Version); }
public void TestOnFlowFinished_ResetsValues() { _objectUnderTest.DeploymentVersion = "test-deployment-version"; _objectUnderTest.DeploymentName = "test-deployment-name"; _objectUnderTest.Replicas = "200"; _objectUnderTest.RefreshClustersListCommand.CanExecuteCommand = true; _objectUnderTest.CreateClusterCommand.CanExecuteCommand = true; _objectUnderTest.OnFlowFinished(); Assert.AreEqual(GcpPublishStepsUtils.GetDefaultVersion(), _objectUnderTest.DeploymentVersion); Assert.IsNull(_objectUnderTest.DeploymentName); Assert.AreEqual(GkeStepViewModel.ReplicasDefaultValue, _objectUnderTest.Replicas); Assert.IsFalse(_objectUnderTest.RefreshClustersListCommand.CanExecuteCommand); Assert.IsFalse(_objectUnderTest.CreateClusterCommand.CanExecuteCommand); }
private async Task InitializeDialogState() { try { // Mark that the project is being loaded and verified. LoadingProject = true; if (string.IsNullOrEmpty(DeploymentName)) { DeploymentName = PublishDialog.Project.Name.ToLower(); } if (string.IsNullOrEmpty(DeploymentVersion)) { DeploymentVersion = GcpPublishStepsUtils.GetDefaultVersion(); } Task <bool> validateTask = ValidateGcpProjectState(); PublishDialog.TrackTask(validateTask); if (await validateTask) { Task <IEnumerable <Cluster> > clustersTask = GetAllClustersAsync(); PublishDialog.TrackTask(clustersTask); Clusters = await clustersTask; } } catch (Exception ex) when(!ErrorHandlerUtils.IsCriticalException(ex)) { CanPublish = false; GeneralError = true; } finally { LoadingProject = false; } }