public void TestCreate1() { var rf = new Mock<IPerformanceRecordFactory>(); rf.Setup(a => a.CreateChildRecord(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IPerformanceRecord>())) .Returns(new Mock<IPerformanceRecord>().Object); var pi = new PerformanceTelemetry.Record.PerformanceRecord(string.Empty, string.Empty, rf.Object, null, null); }
public void TestDeepestActiveChild0() { var rf = new Mock<IPerformanceRecordFactory>(); rf.Setup(a => a.CreateChildRecord(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IPerformanceRecord>())) .Returns(new Mock<IPerformanceRecord>().Object); var tf = new Mock<IPerformanceTimerFactory>(); tf.Setup(a => a.CreatePerformanceTimer()) .Returns(new Mock<IPerformanceTimer>().Object); var pi = new PerformanceTelemetry.Record.PerformanceRecord(string.Empty, string.Empty, rf.Object, tf.Object, null); var child = pi.GetDeepestActiveRecord(); Assert.AreSame(pi, child); }
public void TestSetExceptionFlag0() { var pr = new Mock<IPerformanceRecord>(); pr.Setup(a => a.GetDeepestActiveRecord()) .Returns(pr.Object); var rf = new Mock<IPerformanceRecordFactory>(); rf.Setup(a => a.CreateChildRecord(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IPerformanceRecord>())) .Returns(pr.Object); var tf = new Mock<IPerformanceTimerFactory>(); tf.Setup(a => a.CreatePerformanceTimer()) .Returns(new Mock<IPerformanceTimer>().Object); var pi = new PerformanceTelemetry.Record.PerformanceRecord(string.Empty, string.Empty, rf.Object, tf.Object, null); pi.SetExceptionFlag(new Exception()); }
public void TestClose1() { var pr = new Mock<IPerformanceRecord>(); pr.Setup(a => a.GetDeepestActiveRecord()) .Returns(pr.Object); var rf = new Mock<IPerformanceRecordFactory>(); rf.Setup(a => a.CreateChildRecord(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IPerformanceRecord>())) .Returns(pr.Object); var tf = new Mock<IPerformanceTimerFactory>(); tf.Setup(a => a.CreatePerformanceTimer()) .Returns(new Mock<IPerformanceTimer>().Object); var pi = new PerformanceTelemetry.Record.PerformanceRecord(string.Empty, string.Empty, rf.Object, tf.Object, null); pi.Close(); Assert.IsFalse(pi.Active); }
public void TestCreate2() { var tf = new Mock<IPerformanceTimerFactory>(); tf.Setup(a => a.CreatePerformanceTimer()) .Returns(new Mock<IPerformanceTimer>().Object); var pi = new PerformanceTelemetry.Record.PerformanceRecord(string.Empty, string.Empty, null, tf.Object, null); }