public void ReportingCloudAPIKeyTest() { try { ReportingCloud rc = new ReportingCloud(sUsername, sPassword, uriBasePath); string sAPIKey; bool bKeyCreated = false; // create a new key, if no keys exist if (rc.GetAccountAPIKeys().Count == 0) { sAPIKey = rc.CreateAccountAPIKey(); bKeyCreated = true; } else { sAPIKey = rc.GetAccountAPIKeys()[0].Key; } // create new instance with new API Key ReportingCloud rc2 = new ReportingCloud(sAPIKey, uriBasePath); // check account settings var accountSettings = rc2.GetAccountSettings(); Assert.IsFalse(accountSettings.MaxDocuments == 0); // remove created key if (bKeyCreated == true) { rc.DeleteAccountAPIKey(sAPIKey); } } catch (Exception exc) { Assert.Fail(exc.Message); } }
public void GetAccountSettingsTest() { try { ReportingCloud rc = new ReportingCloud(sUsername, sPassword, uriBasePath); AccountSettings settings = rc.GetAccountSettings(); // upload 1 more document with unique file name byte[] bDocument = File.ReadAllBytes("documents/invoice.tx"); string sTempFilename = "test" + Guid.NewGuid().ToString() + ".tx"; rc.UploadTemplate(sTempFilename, bDocument); // check, if the count went up Assert.AreEqual(settings.UploadedTemplates + 1, rc.GetTemplateCount()); // delete temp document rc.DeleteTemplate(sTempFilename); } catch (Exception exc) { Assert.Fail(exc.Message); } }