private void AssertThatAccountJsonResemblesDto(JToken accountJson, AccountDto account) { accountJson.Should().NotBeNull(); account.GetType().GetProperties().Length.Should().Be(accountJson.Count()); accountJson["accountId"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["accountId"].Value <int>().Should().NotBe(0); accountJson["accountTypeId"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["accountTypeId"].Value <int>().Should().Be(account.AccountTypeId); accountJson["archetypeId"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["archetypeId"].Value <int>().Should().Be(account.ArchetypeId); accountJson["salesforceAccountId"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["salesforceAccountId"].Value <string>().Should().NotBeNullOrEmpty().And.Be(account.SalesforceAccountId); accountJson["salesforceAccountManager"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["salesforceAccountManager"].Value <string>().Should().NotBeNullOrEmpty().And.Be(account.SalesforceAccountManager); accountJson["salesforceAccountNumber"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["salesforceAccountNumber"].Value <string>().Should().BeNullOrEmpty(); accountJson["salesforceAccountUrl"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["salesforceAccountUrl"].Value <string>().Should().NotBeNullOrEmpty().And.Be(account.SalesforceAccountUrl); accountJson["contractNumber"].Should().NotBeNull().And.BeOfType <JValue>(); accountJson["contractNumber"].Value <string>().Should().NotBeNullOrEmpty().And.Be(account.ContractNumber); accountJson["subscriptions"].Should().BeOfType <JArray>().And.NotBeNullOrEmpty().And.HaveCount(account.Subscriptions.Count); for (var i = 0; i < account.Subscriptions.Count; i++) { var subscription = account.Subscriptions[i]; var subscriptionJson = ((JArray)accountJson["subscriptions"])[i]; subscription.GetType().GetProperties().Length.Should().Be(subscriptionJson.Count()); subscriptionJson["subscriptionName"].Should().NotBeNull().And.BeOfType <JValue>(); subscriptionJson["subscriptionName"].Value <string>().Should().NotBeNullOrEmpty().And.Be(subscription.SubscriptionName); subscriptionJson["description"].Should().NotBeNull().And.BeOfType <JValue>(); subscriptionJson["description"].Value <string>().Should().NotBeNullOrEmpty().And.Be(subscription.Description); subscriptionJson["organizationalUnit"].Should().NotBeNull().And.BeOfType <JValue>(); subscriptionJson["organizationalUnit"].Value <string>().Should().NotBeNullOrEmpty().And.Be(subscription.OrganizationalUnit); subscriptionJson["subscriptionTypeId"].Should().NotBeNull().And.BeOfType <JValue>(); subscriptionJson["subscriptionTypeId"].Value <int>().Should().Be(subscription.SubscriptionTypeId); subscriptionJson["tags"].Should().BeOfType <JObject>().And.NotBeNullOrEmpty().And.HaveCount(subscription.Tags.Count); } accountJson["identityProviders"].Should().BeOfType <JArray>().And.NotBeNullOrEmpty().And.HaveCount(account.IdentityProviders.Count); }