public void itGeneratesTheMetadataWithoutError() { MnoHelper.Environment = "production"; MnoHelper.Api.Id = "app-1"; MnoHelper.Api.Key = "bla"; Assert.IsNotNull(MnoHelper.ToMetadata()); }
public void ToMetadata_ItReturnsTheRightObject() { MnoHelper.Environment = "production"; MnoHelper.App.Host = "https://mysuperapp.com"; MnoHelper.Api.Id = "app-1"; MnoHelper.Api.Key = "somekey"; JObject expected = new JObject( new JProperty("environment", MnoHelper.Environment), new JProperty("app", new JObject(new JProperty("host", MnoHelper.App.Host))), new JProperty("api", new JObject( new JProperty("id", MnoHelper.Api.Id), new JProperty("lang", MnoHelper.Api.Lang), new JProperty("version", MnoHelper.Api.Version), new JProperty("lang_version", MnoHelper.Api.LangVersion))), new JProperty("sso", new JObject( new JProperty("enabled", MnoHelper.Sso.Enabled), new JProperty("creation_mode", MnoHelper.Sso.CreationMode), new JProperty("init_path", MnoHelper.Sso.InitPath), new JProperty("consume_path", MnoHelper.Sso.ConsumePath), new JProperty("idm", MnoHelper.Sso.Idm), new JProperty("idp", MnoHelper.Sso.Idp), new JProperty("name_id_format", MnoHelper.Sso.NameIdFormat), new JProperty("x509_fingerprint", MnoHelper.Sso.X509Fingerprint), new JProperty("x509_certificate", MnoHelper.Sso.X509Certificate))), new JProperty("webhook", new JObject( new JProperty("account", new JObject( new JProperty("groups_path", MnoHelper.Webhook.Account.GroupsPath), new JProperty("group_users_path", MnoHelper.Webhook.Account.GroupUsersPath) )), new JProperty("connec", new JObject( new JProperty("notifications_path", MnoHelper.Webhook.Connec.NotificationsPath), new JProperty("subscriptions", new JObject( new JProperty("accounts", MnoHelper.Webhook.Connec.Subscriptions.Accounts), new JProperty("company", MnoHelper.Webhook.Connec.Subscriptions.Company), new JProperty("invoices", MnoHelper.Webhook.Connec.Subscriptions.Invoices), new JProperty("items", MnoHelper.Webhook.Connec.Subscriptions.Items), new JProperty("organizations", MnoHelper.Webhook.Connec.Subscriptions.Organizations), new JProperty("payments", MnoHelper.Webhook.Connec.Subscriptions.Payments), new JProperty("people", MnoHelper.Webhook.Connec.Subscriptions.People), new JProperty("tax_codes", MnoHelper.Webhook.Connec.Subscriptions.TaxCodes), new JProperty("tax_rates", MnoHelper.Webhook.Connec.Subscriptions.TaxRates) )) )))) ); Assert.AreEqual(expected.ToString(), MnoHelper.ToMetadata().ToString()); }
public void ToMetadata_ItReturnsTheRightObject() { MnoHelper.Environment = "production"; MnoHelper.App.Host = "https://mysuperapp.com"; MnoHelper.Api.Id = "app-1"; MnoHelper.Api.Key = "somekey"; JObject expected = new JObject( new JProperty("environment", MnoHelper.Environment), new JProperty("app", new JObject(new JProperty("host", MnoHelper.App.Host))), new JProperty("api", new JObject( new JProperty("id", MnoHelper.Api.Id), new JProperty("lang", MnoHelper.Api.Lang), new JProperty("version", MnoHelper.Api.Version), new JProperty("lang_version", MnoHelper.Api.LangVersion))), new JProperty("sso", new JObject( new JProperty("enabled", MnoHelper.Sso.Enabled), new JProperty("creation_mode", MnoHelper.Sso.CreationMode), new JProperty("init_path", MnoHelper.Sso.InitPath), new JProperty("consume_path", MnoHelper.Sso.ConsumePath), new JProperty("idm", MnoHelper.Sso.Idm), new JProperty("idp", MnoHelper.Sso.Idp), new JProperty("name_id_format", MnoHelper.Sso.NameIdFormat), new JProperty("x509_fingerprint", MnoHelper.Sso.X509Fingerprint), new JProperty("x509_certificate", MnoHelper.Sso.X509Certificate))), new JProperty("webhook", new JObject( new JProperty("account", new JObject( new JProperty("groups_path", MnoHelper.Webhook.Account.GroupsPath), new JProperty("group_users_path", MnoHelper.Webhook.Account.GroupUsersPath) )), new JProperty("connec", new JObject( new JProperty("notifications_path", MnoHelper.Webhook.Connec.NotificationsPath), new JProperty("subscriptions", new JObject( new JProperty("accounts", MnoHelper.Webhook.Connec.Subscriptions.Accounts), new JProperty("company", MnoHelper.Webhook.Connec.Subscriptions.Company), new JProperty("invoices", MnoHelper.Webhook.Connec.Subscriptions.Invoices), new JProperty("sales_orders", MnoHelper.Webhook.Connec.Subscriptions.SalesOrders), new JProperty("purchase_orders", MnoHelper.Webhook.Connec.Subscriptions.PurchaseOrders), new JProperty("quotes", MnoHelper.Webhook.Connec.Subscriptions.Quotes), new JProperty("payments", MnoHelper.Webhook.Connec.Subscriptions.Payments), new JProperty("journals", MnoHelper.Webhook.Connec.Subscriptions.Journals), new JProperty("items", MnoHelper.Webhook.Connec.Subscriptions.Items), new JProperty("organizations", MnoHelper.Webhook.Connec.Subscriptions.Organizations), new JProperty("people", MnoHelper.Webhook.Connec.Subscriptions.People), new JProperty("projects", MnoHelper.Webhook.Connec.Subscriptions.Projects), new JProperty("tax_codes", MnoHelper.Webhook.Connec.Subscriptions.TaxCodes), new JProperty("tax_rates", MnoHelper.Webhook.Connec.Subscriptions.TaxRates), new JProperty("events", MnoHelper.Webhook.Connec.Subscriptions.Events), new JProperty("venues", MnoHelper.Webhook.Connec.Subscriptions.Venues), new JProperty("event_orders", MnoHelper.Webhook.Connec.Subscriptions.EventOrders), new JProperty("work_locations", MnoHelper.Webhook.Connec.Subscriptions.WorkLocations), new JProperty("pay_items", MnoHelper.Webhook.Connec.Subscriptions.PayItems), new JProperty("employees", MnoHelper.Webhook.Connec.Subscriptions.Employees), new JProperty("pay_schedules", MnoHelper.Webhook.Connec.Subscriptions.PaySchedules), new JProperty("time_sheets", MnoHelper.Webhook.Connec.Subscriptions.TimeSheets), new JProperty("time_activities", MnoHelper.Webhook.Connec.Subscriptions.TimeActivities), new JProperty("pay_runs", MnoHelper.Webhook.Connec.Subscriptions.PayRuns), new JProperty("pay_stubs", MnoHelper.Webhook.Connec.Subscriptions.PayStubs) )) )))) ); Assert.AreEqual(expected.ToString(), MnoHelper.ToMetadata().ToString()); }