Exemplo n.º 1
0
        public void TrackDurationToHashPackage_TracksDuration()
        {
            const string PackageId            = "a";
            const string NormalizedVersion    = "b";
            const long   PackageSize          = 3;
            Guid         validationTrackingId = new Guid();
            const string HashAlgorithm        = "c";
            const string StreamType           = "d";

            var expectedReturnValue = Mock.Of <IDisposable>();

            _telemetryClient.Setup(
                x => x.TrackMetric(
                    It.IsNotNull <string>(),
                    It.IsAny <double>(),
                    It.IsNotNull <IDictionary <string, string> >()))
            .Callback((string metricName, double value, IDictionary <string, string> properties) =>
            {
                Assert.Equal("Orchestrator.DurationToHashPackageSeconds", metricName);
                Assert.True(value > 0);
                Assert.NotEmpty(properties);
                Assert.Equal(new Dictionary <string, string>()
                {
                    { "PackageId", PackageId },
                    { "NormalizedVersion", NormalizedVersion },
                    { "ValidationTrackingId", validationTrackingId.ToString() },
                    { "PackageSize", PackageSize.ToString() },
                    { "HashAlgorithm", HashAlgorithm },
                    { "StreamType", StreamType }
                }, properties);
            });

            using (_telemetryService.TrackDurationToHashPackage(
                       PackageId,
                       NormalizedVersion,
                       validationTrackingId,
                       PackageSize,
                       HashAlgorithm,
                       StreamType))
            {
            }

            _telemetryClient.VerifyAll();
        }