Ejemplo n.º 1
0
        public void TestClosePerformanceSession0()
        {
            var rf = new Mock<IPerformanceRecordFactory>();
            rf.Setup(a => a.CreateRecord(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(new Mock<IPerformanceRecord>().Object);
            rf.Setup(a => a.CreateChildRecord(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IPerformanceRecord>()))
                .Returns(new Mock<IPerformanceRecord>().Object);

            var sf = new Mock<IPerformanceSaver>();

            var pc = new PerformanceTelemetry.Container.PerformanceContainer(
                new EmptyLoggerAdapter(),
                rf.Object,
                sf.Object);

            var r = pc.OpenPerformanceSession(
                1,
                string.Empty,
                string.Empty);

            Assert.IsNotNull(r);

            pc.ClosePerformanceSession(1, r);


        }
Ejemplo n.º 2
0
        public void TestClosePerformanceSession1()
        {
            var rf = new Mock<IPerformanceRecordFactory>();
            rf.Setup(a => a.CreateRecord(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(new Mock<IPerformanceRecord>().Object);
            rf.Setup(a => a.CreateChildRecord(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IPerformanceRecord>()))
                .Returns(new Mock<IPerformanceRecord>().Object);

            var sf = new Mock<IPerformanceSaver>();

            var pc = new PerformanceTelemetry.Container.PerformanceContainer(
                new EmptyLoggerAdapter(),
                rf.Object,
                sf.Object);

            var r = new Mock<IPerformanceRecord>();

            pc.ClosePerformanceSession(1, r.Object);

            r.Verify(a => a.Close());

        }