public void CanCreateUpdateDeleteCredential() { using (var undoContext = UndoContext.Current) { undoContext.Start(); using (AutomationTestBase _testFixture = new AutomationTestBase()) { var credentialName = TestUtilities.GenerateName("credential"); var userName = "******"; var password = "******"; Credential credential = _testFixture.CreateCredential(credentialName, userName, password); Assert.NotNull(credential); credential = _testFixture.GetCredential(credential.Name); Assert.NotNull(credential); Assert.Equal(userName, credential.Properties.UserName); userName = "******"; password = "******"; credential.Properties.UserName = userName; credential.Properties.Description = "description of credential"; _testFixture.UpdateCredential(credential, password); var credentials = _testFixture.GetCredentials(); Assert.Equal(1, credentials.Count); var updatedCredential = credentials[0]; Assert.Equal(credential.Properties.UserName, updatedCredential.Properties.UserName); Assert.Equal(credential.Properties.Description, updatedCredential.Properties.Description); _testFixture.DeleteCredential(credential.Name); Assert.Throws <CloudException>(() => { credential = _testFixture.GetCredential(credential.Name); }); } } }
public void CanCreateUpdateDeleteCredential() { using (var undoContext = UndoContext.Current) { undoContext.Start(); using (AutomationTestBase _testFixture = new AutomationTestBase()) { var credentialName = TestUtilities.GenerateName("credential"); var userName = "******"; var password = "******"; Credential credential = _testFixture.CreateCredential(credentialName, userName, password); Assert.NotNull(credential); credential = _testFixture.GetCredential(credential.Name); Assert.NotNull(credential); Assert.Equal(userName, credential.Properties.UserName); userName = "******"; password = "******"; credential.Properties.UserName = userName; credential.Properties.Description = "description of credential"; _testFixture.UpdateCredential(credential, password); var credentials = _testFixture.GetCredentials(); Assert.Equal(1, credentials.Count); var updatedCredential = credentials[0]; Assert.Equal(credential.Properties.UserName, updatedCredential.Properties.UserName); Assert.Equal(credential.Properties.Description, updatedCredential.Properties.Description); _testFixture.DeleteCredential(credential.Name); Assert.Throws<CloudException>(() => { credential = _testFixture.GetCredential(credential.Name); }); } } }