Exemplo 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);
        }
Exemplo n.º 2
0
        public void Dispose_WhenCalledTwice_DoesNotThrow()
        {
            var map = new ArticleOrderMetricMap();

            Assert.That(() => map.Dispose(), Throws.Nothing);
            Assert.That(() => map.Dispose(), Throws.Nothing);
        }
Exemplo n.º 3
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);
        }