Пример #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);
        }
Пример #2
0
        public void PopulateTestInvalidIdentifier()
        {
            //Arrange
            TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            BackupCode  backup = new BackupCode(client);

            //Act
            backup.Populate("myIdentifier");
        }
Пример #3
0
        public void PopulateTestNull()
        {
            //Arrange
            TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            BackupCode  backup = new BackupCode(client);

            //Act
            backup.Populate(null);
        }
Пример #4
0
        public void VerifyTest2()
        {
            //Arrange
            TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            BackupCode  backup = new BackupCode(client);

            //Act
            backup.Verify("myToken");
        }
Пример #5
0
        public void VerifyTest()
        {
            //Arrange
            TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            BackupCode  backup = new BackupCode(client);

            //Act
            backup.Verify(null, "myIdentifier");
        }
Пример #6
0
        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);
        }
Пример #7
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);
        }