Exemple #1
0
 public void GetAccountInfo_Without_Authentication_Throws_AuphonicException()
 {
     Assert.That(() => _auphonic.GetAccountInfo(), Throws
                 .InstanceOf <AuphonicException>()
                 .And.Property("ErrorCode").EqualTo("")
                 .And.Property("ErrorMessage").EqualTo(MessageNoCredentials));
 }
        public void Invoke_Authenticate_With_Invalid_Token_Throws_AuthenticationException()
        {
            HasClientCredentials();

            var auphonic = new Auphonic(_clientId, _clientSecret);

            auphonic.Authenticate("24p5w92x9a");

            Assert.That(() => auphonic.GetAccountInfo(), Throws
                        .InstanceOf <AuthenticationException>()
                        .And.Property("Message").EqualTo("Token doesn't exist"));
        }
        public void Invoke_GetAccountInfo_Returns_Result()
        {
            HasAccessToken();

            Account account = null;

            Assert.That(() => account = _auphonic.GetAccountInfo(), Throws.Nothing);
            Assert.That(account, Is.Not.Null);
            Assert.Multiple(() =>
            {
                Assert.That(account.DateJoined, Is.Not.EqualTo(DateTime.MinValue), "DateJoined");
                Assert.That(account.RechargeDate, Is.Not.EqualTo(DateTime.MinValue), "RechargeDate");
                Assert.That(String.IsNullOrWhiteSpace(account.Email), Is.False, "Email is null or whitespace");
                Assert.That(String.IsNullOrWhiteSpace(account.UserId), Is.False, "UserId is null or whitespace");
                Assert.That(String.IsNullOrWhiteSpace(account.Username), Is.False, "Username is null or whitespace");
            });
        }