Exemplo n.º 1
0
        public void Get_Unauthorized_Error_Test()
        {
            using (var httpClient = FakeClientWithJsonResponse("TestData\\Error.json"))
            {
                var apiClient = new HelloSignClient(httpClient);
                var t = apiClient.GetAccount();

                var expected = new HSError
                {
                    ErrorMsg = "Unauthorized user.",
                    ErrorName = "unauthorized"
                };

                Assert.False(t.Result.IsSuccess);
                Assert.True(t.Result.HasError);
                Assert.Equal(expected, t.Result.Error);
            }
        }
Exemplo n.º 2
0
        public void Get_Warning_Response_Test()
        {
            using (var httpClient = FakeClientWithJsonResponse("TestData\\Warning.json"))
            {
                var apiClient = new HelloSignClient(httpClient);
                var t = apiClient.GetAccount();

                var warnings = new List<HSWarning>();
                var expected = new HSWarning
                {
                    WarningMsg = "This SignatureRequest will be placed on hold until the user confirms their email address.",
                    WarningName = "unconfirmed"
                };
                warnings.Add(expected);

                Assert.False(t.Result.IsSuccess);
                Assert.True(t.Result.HasWarnings);
                Assert.Equal(warnings[0], t.Result.Warnings[0]);
            }
        }
Exemplo n.º 3
0
        public void Get_Account_Response_Test()
        {
            using (var httpClient = FakeClientWithJsonResponse("TestData\\GetAccount-OK.json"))
            {
                var apiClient = new HelloSignClient(httpClient);
                var t = apiClient.GetAccount();

                var expected = new HSAccount
                {
                    AccountId = "abcXYZ",
                    EmailAddress = "*****@*****.**",
                    IsPaidHS = true,
                    IsPaidHF = false,
                    CallbackUrl = null,
                    RoleCode = null,
                    Quotas = new HSQuotas
                    {
                        ApiSignatureRequest = 1250,
                        DocumentsLeft = null,
                        TemplatesLeft = null
                    }
                };

                Assert.Equal(expected, t.Result.Account);
            }
        }