Exemplo n.º 1
0
        public void CanUpdateMetadata()
        {
            // arrange
            var client     = GetClient();
            var category   = "Integration";
            var collection = "Tests";
            var key        = "456988";

            var expected = new MetadataModelContract
            {
                Data = JsonConvert.SerializeObject(new Dictionary <string, string>
                {
                    { "accountNumber", key },
                    { "marginAccount", "MA02" },
                    { "referenceAccount", "RF12" },
                    { "bankIdentificationReference", "BIR12" },
                })
            };

            MetadataModelContract actual = null;

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

            $"When try to update metadata for the category: {category} collection: {collection} key: {key}"
            .x(async() =>
            {
                expected.Data = JsonConvert.SerializeObject(new Dictionary <string, string>
                {
                    { "accountNumber", key },
                    { "referenceAccount", "SomeNewRef" }
                });

                await client.Update(category, collection, key, expected);
            });

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

            "Then the fetched metadata should be same as updated metadata"
            .x(() =>
            {
                Assert.NotNull(actual);
                actual.Should().BeEquivalentTo(expected);
            });
        }