コード例 #1
0
        public void WhenInvokeWithNoEventDataItSendsEvents()
        {
            var engine = new MockBuildEngine5();

            AllowEmptyTelemetry telemetryTask = new AllowEmptyTelemetry
            {
                BuildEngine = engine,
                EventName   = "My event name"
            };

            bool retVal = telemetryTask.Execute();

            retVal.Should().BeTrue();
            engine.Log.Should().Contain(telemetryTask.EventName);
        }
コード例 #2
0
        public void WhenInvokeWithInvalidEventDataItThrows()
        {
            var engine = new MockBuildEngine5();

            AllowEmptyTelemetry telemetryTask = new AllowEmptyTelemetry
            {
                BuildEngine = engine,
                EventName   = "My event name",
                EventData   = "Property1=Value1;=Value2"
            };

            Action a = () => telemetryTask.Execute();

            a.ShouldThrow <ArgumentException>();
        }
コード例 #3
0
        public void WhenInvokeWithoutValueItSendValueAsNull(string eventData)
        {
            var engine = new MockBuildEngine5();

            AllowEmptyTelemetry telemetryTask = new AllowEmptyTelemetry
            {
                BuildEngine = engine,
                EventName   = "My event name",
                EventData   = eventData
            };

            telemetryTask.Execute();

            engine.Log.Should().Contain("'Property1' = 'null'");
        }
コード例 #4
0
        public void WhenInvokeWithDuplicatedEventDataItKeepsTheLastOne()
        {
            var engine = new MockBuildEngine5();

            AllowEmptyTelemetry telemetryTask = new AllowEmptyTelemetry
            {
                BuildEngine = engine,
                EventName   = "My event name",
                EventData   = "Property1=EE2493A167D24F00996DE7C8E769EAE6;Property1=4ADE3D2622CA400B8B95A039DF540037"
            };

            bool retVal = telemetryTask.Execute();

            retVal.Should().BeTrue();

            engine.Log.Should().NotContain("EE2493A167D24F00996DE7C8E769EAE6");
            engine.Log.Should().Contain("4ADE3D2622CA400B8B95A039DF540037");
        }