Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        public void PopulateTestNull()
        {
            //Arrange
            TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            BackupCode  backup = new BackupCode(client);

            //Act
            backup.Populate(null);
        }
Ejemplo n.º 3
0
        public void PopulateTestInvalidIdentifier()
        {
            //Arrange
            TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            BackupCode  backup = new BackupCode(client);

            //Act
            backup.Populate("myIdentifier");
        }
Ejemplo n.º 4
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);
        }