Exemple #1
0
        public void CanGetMetadataWithKeywords()
        {
            // arrange
            var client     = new ChestClient(this.ServiceUrl, new[] { new SuccessHandler() });
            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.Metadata.Add(category, collection, key, expected, expectedKeywords).ConfigureAwait(false);
            });

            $"When try to get metadata with keywords for the category: {category} collection: {collection} key: {key}"
            .x(async() =>
            {
                actual = await client.Metadata.GetWithKeywords <AssetAccountMetadata>(category, collection, key).ConfigureAwait(false);
            });

            "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);
            });
        }
Exemple #2
0
        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);
            });
        }
Exemple #3
0
        public void CanAddMetadataUsingDto()
        {
            var client     = GetClient();
            var category   = "Integration";
            var collection = "Tests";
            var key        = "556988";

            var expected = new AssetAccountMetadata
            {
                AccountNumber               = key,
                MarginAccount               = "MA01",
                ReferenceAccount            = "RF11",
                BankIdentificationReference = "BIR11",
            };

            AssetAccountMetadata actual = null;

            $"Given the AssetAccountMetadata for key: {key}"
            .x(async() =>
            {
                await client.Create(category, collection, key, new MetadataModelContract
                {
                    Data = expected.ToJson(),
                });
            });

            $"When try to get AssetAccountMetadata for the key: {key}"
            .x(async() =>
            {
                actual = (await client.Get(category, collection, key)).Get <AssetAccountMetadata>();
            });

            "Then the fetched AssetAccountMetadata should be same"
            .x(() =>
            {
                Assert.NotNull(actual);
                actual.Should().BeEquivalentTo(expected);
            });
        }
Exemple #4
0
        public void CanAddMetadataWithoutKeywords()
        {
            // arrange
            var client     = new ChestClient(this.ServiceUrl, new[] { new SuccessHandler() });
            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.Metadata.Add(category, collection, key, expected).ConfigureAwait(false);
            });

            $"When try to get metadata for the category: {category} collection: {collection} key: {key}"
            .x(async() =>
            {
                actual = await client.Metadata.Get <AssetAccountMetadata>(category, collection, key).ConfigureAwait(false);
            });

            "Then the fetched metadata should be same"
            .x(() =>
            {
                Assert.NotNull(actual);
                actual.Should().BeEquivalentTo(expected);
            });
        }
Exemple #5
0
        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);
            });
        }
Exemple #6
0
        public void CanGetCategories()
        {
            var client     = new ChestClient(this.ServiceUrl, new[] { new SuccessHandler() });
            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.Metadata.Add <AssetAccountMetadata>(category, collection, key, expected).ConfigureAwait(false);
            });

            $"When try to get all categories"
            .x(async() =>
            {
                actualCategories = await client.Metadata.GetCategoriesAsync().ConfigureAwait(false);
            });

            "Then the fetched categories should contain the added category"
            .x(() =>
            {
                Assert.NotNull(actualCategories);
                actualCategories.Should().Contain(category);
            });
        }
Exemple #7
0
        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);
            });
        }