public static void RequestJWTUserToken_CorrectInputParameters_ReturnsOAuthToken(ref TestConfig testConfig) { testConfig.ApiClient = new ApiClient(testConfig.Host); Assert.IsNotNull(testConfig?.PrivateKey); byte[] privateKeyStream = testConfig.PrivateKey; var scopes = new List <string> { OAuth.Scope_SIGNATURE, OAuth.Scope_IMPERSONATION }; OAuth.OAuthToken tokenInfo = testConfig.ApiClient.RequestJWTUserToken( testConfig.IntegratorKey, testConfig.UserId, testConfig.OAuthBasePath, privateKeyStream, testConfig.ExpiresInHours, scopes); OAuth.UserInfo userInfo = testConfig.ApiClient.GetUserInfo(tokenInfo.access_token); Assert.IsNotNull(userInfo?.Accounts); foreach (OAuth.UserInfo.Account item in userInfo.Accounts) { if (item.IsDefault == "true") { testConfig.AccountId = item.AccountId; testConfig.ApiClient.SetBasePath(item.BaseUri + "/restapi"); break; } } Assert.IsNotNull(testConfig?.AccountId); CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref testConfig); }
public static void CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref TestConfig testConfig, string status = "sent") { var signTest1File = @"../../../docs/SignTest1.pdf"; byte[] fileBytes = File.ReadAllBytes(signTest1File); var envDef = new EnvelopeDefinition { EmailSubject = "[DocuSign C# SDK] - Please sign this doc" }; var doc = new Document { DocumentBase64 = Convert.ToBase64String(fileBytes), Name = "TestFile.pdf", DocumentId = "1" }; envDef.Documents = new List <Document> { doc }; var signer = new Signer { Email = testConfig.RecipientEmail, Name = testConfig.RecipientName, RecipientId = "1", ClientUserId = "1234", Tabs = new Tabs { SignHereTabs = new List <SignHere>() } }; var signHere = new SignHere { DocumentId = "1", PageNumber = "1", RecipientId = "1", XPosition = "100", YPosition = "100", ScaleValue = ".5" }; signer.Tabs.SignHereTabs.Add(signHere); envDef.Recipients = new Recipients { Signers = new List <Signer> { signer } }; envDef.Status = status; var envelopesApi = new EnvelopesApi(testConfig.ApiClient); EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(testConfig.AccountId, envDef); Assert.IsNotNull(envelopeSummary?.EnvelopeId); testConfig.EnvelopeId = envelopeSummary.EnvelopeId; }
public void TestInitialize() { _testConfig = new TestConfig(); JwtLoginMethod.RequestJWTUserToken_CorrectInputParameters_ReturnsOAuthToken(ref _testConfig); _diagnosticsApi = new DiagnosticsApi(_testConfig.ApiClient); }