public void CanGetMetadataWithKeywords() { // arrange var client = GetClient(); var category = "Integration"; var collection = "Tests"; var key = "456990"; var expected = new AssetAccountMetadata { AccountNumber = key, MarginAccount = "MA04", ReferenceAccount = "RF 14", BankIdentificationReference = "BIR 14", }; var expectedKeywords = new List <string> { expected.ReferenceAccount, expected.BankIdentificationReference }; (AssetAccountMetadata metadata, IList <string> keywords)actual = (null, null); $"Given the metadata for category: {category} collection: {collection} key: {key}" .x(async() => { await client.Create(category, collection, key, expected.ToChestContract(expectedKeywords)); }); $"When try to get metadata with keywords for the category: {category} collection: {collection} key: {key}" .x(async() => { actual = (await client.Get(category, collection, key)).GetWithKeywords <AssetAccountMetadata>(); }); "Then the fetched metadata and keywords should be same" .x(() => { Assert.NotNull(actual.metadata); Assert.NotNull(actual.keywords); actual.metadata.Should().BeEquivalentTo(expected); actual.keywords.Should().BeEquivalentTo(expectedKeywords); }); }
public void CanGetKeysWithData() { var client = GetClient(); var category = "Integration"; var collection = "Tests"; var key = "556985"; var expected = new AssetAccountMetadata { AccountNumber = key, MarginAccount = "MA07", ReferenceAccount = "RF17", BankIdentificationReference = "BIR17", }; IDictionary <string, AssetAccountMetadata> actualKeysWithData = null; $"Given the AssetAccountMetadata for category: {category} collection: {collection} key: {key}" .x(async() => { await client.Create(category, collection, key, expected.ToChestContract()); }); $"When try to get all keys with data for category: {category} collection: {collection}" .x(async() => { actualKeysWithData = (await client.GetKeysWithData(category, collection, null)) .Get <AssetAccountMetadata>(); }); "Then the fetched keys with data should contain the given key and data should be same agains the key" .x(() => { Assert.NotNull(actualKeysWithData); actualKeysWithData.Should().ContainKey(key); actualKeysWithData.TryGetValue(key, out var actual); actual.Should().BeEquivalentTo(expected); }); }
public void CanAddMetadataWithoutKeywords() { // arrange var client = GetClient(); var category = "Integration"; var collection = "Tests"; var key = "456989"; var expected = new AssetAccountMetadata { AccountNumber = key, MarginAccount = "MA02", ReferenceAccount = "RF12", BankIdentificationReference = "BIR12", }; AssetAccountMetadata actual = null; $"Given the metadata for category: {category} collection: {collection} key: {key}" .x(async() => { await client.Create(category, collection, key, expected.ToChestContract()); }); $"When try to get metadata for the category: {category} collection: {collection} key: {key}" .x(async() => { actual = (await client.Get(category, collection, key)).Get <AssetAccountMetadata>(); }); "Then the fetched metadata should be same" .x(() => { Assert.NotNull(actual); actual.Should().BeEquivalentTo(expected); }); }
public void CanGetCategories() { var client = GetClient(); var category = "Integration"; var collection = "Tests"; var key = "556990"; var expected = new AssetAccountMetadata { AccountNumber = key, MarginAccount = "MA06", ReferenceAccount = "RF16", BankIdentificationReference = "BIR16", }; IList <string> actualCategories = null; $"Given the AssetAccountMetadata for category: {category} collection: {collection} key: {key}" .x(async() => { await client.Create(category, collection, key, expected.ToChestContract()); }); $"When try to get all categories" .x(async() => { actualCategories = await client.GetCategories(); }); "Then the fetched categories should contain the added category" .x(() => { Assert.NotNull(actualCategories); actualCategories.Should().Contain(category); }); }