Esempio n. 1
0
        public void Map_WhenCalledWithInvalidCharacters_ReturnsExpectedValues()
        {
            var map = new ArticleOrderMetricMap(
                quantityName: $"{nameof(ArticleOrder.Quantity)}$",
                priceName: $"{nameof(ArticleOrder.Price)}$"
                );
            var sut = new MetricMapService();

            var order = new ArticleOrder
            {
                ArticleId    = "1$",
                AssortmentId = "100$",
                Timestamp    = DateTime.UtcNow.Date,
                Quantity     = 2,
                Price        = 200
            };

            var actual = sut.Map(map, new[] { order }).ToArray();

            foreach (var metric in actual)
            {
                AssertMetric(order, metric, expectedValue: (_ => _.Replace("$", string.Empty)));
            }

            AssertMetric(actual[0], nameof(ArticleOrder.Quantity), 2.0);
            AssertMetric(actual[1], nameof(ArticleOrder.Price), 200.0);
        }
Esempio n. 2
0
        public void Map_WhenCalled_ReturnsExpectedValues()
        {
            var map = new ArticleOrderMetricMap();
            var sut = new MetricMapService();

            var order = new ArticleOrder
            {
                ArticleId    = "1",
                AssortmentId = "100",
                Timestamp    = DateTime.UtcNow.Date,
                Quantity     = 2,
                Price        = 200
            };

            var actual = sut.Map(map, new[] { order }).ToArray();

            foreach (var metric in actual)
            {
                AssertMetric(order, metric);
            }

            AssertMetric(actual[0], nameof(ArticleOrder.Quantity), 2.0);
            AssertMetric(actual[1], nameof(ArticleOrder.Price), 200.0);
        }