public void SetUp()
        {
            _metricNameService = Mock.Create <IMetricNameService>();
            Mock.Arrange(() => _metricNameService.RenameTransaction(Arg.IsAny <TransactionMetricName>()))
            .Returns(name => name);

            _transactionMetricNameMaker = new TransactionMetricNameMaker(_metricNameService);
        }
예제 #2
0
        public TransactionMetricName GetTransactionMetricName(ITransactionName transactionName)
        {
            var proposedTransactionMetricName = new TransactionMetricName(transactionName.IsWeb ? MetricNames.WebTransactionPrefix : MetricNames.OtherTransactionPrefix, transactionName.UnprefixedName);

            var vettedTransactionMetricName = _metricNameService.RenameTransaction(proposedTransactionMetricName);

            return(vettedTransactionMetricName);
        }
        public void BuiltTransactionName_RunsThroughMetricNameService()
        {
            Mock.Arrange(() => _metricNameService.RenameTransaction(Arg.IsAny <TransactionMetricName>()))
            .Returns(_ => new TransactionMetricName("WebTransaction", "NewName"));

            var transactionName = TransactionName.ForWebTransaction("foo", "bar");

            var builtName = _transactionMetricNameMaker.GetTransactionMetricName(transactionName);

            Assert.IsFalse(builtName.ShouldIgnore);
            Assert.AreEqual("WebTransaction/NewName", builtName.PrefixedName);
        }