/// <summary> /// Get the backup code status for the supplied identifier. /// </summary> /// <param name="identifier">The identifier.</param> /// <returns><see cref="BackupCode"/> object with the supplied identifier.</returns> /// <exception cref="EntityException">Thrown when the supplied identifier is empty or null.</exception> /// <exception cref="EntityException">Thrown when the server returns a non-success http status code or an invalid response.</exception> public BackupCode GetBackupCode(string identifier) { BackupCode backupCode = factory.CreateEmptyBackupCode(); backupCode.Populate(identifier); return(backupCode); }
public void PopulateTestInvalidIdentifier() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); BackupCode backup = new BackupCode(client); //Act backup.Populate("myIdentifier"); }
public void PopulateTestNull() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); BackupCode backup = new BackupCode(client); //Act backup.Populate(null); }
public void VerifyTest2() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); BackupCode backup = new BackupCode(client); //Act backup.Verify("myToken"); }
public void VerifyTest() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); BackupCode backup = new BackupCode(client); //Act backup.Verify(null, "myIdentifier"); }
public void UpdateTest() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); BackupCode backup = new BackupCode(client); backup.identifier = "myIdentifier"; //Act //backup.Create(); Response response = backup.Update(); //Assert Assert.AreEqual(response.statusCode, 200); Assert.IsTrue(response.body.Count > 0); }
public void PopulateTest() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); BackupCode backup = new BackupCode(client); backup.identifier = "myIdentifierPopulateTest"; //Act backup.Delete(); backup.Create(); var newBackup = new BackupCode(client); newBackup.Populate(backup.identifier); //Assert Assert.AreEqual(newBackup.identifier, backup.identifier); Assert.AreEqual(newBackup.amountOfCodesLeft, backup.amountOfCodesLeft); }