Beispiel #1
0
        public void CannotAddSentBytesWithInvalidValueSmallerZeroToWebRequestTracer()
        {
            //given
            var target     = new Beacon(logger, new BeaconCache(), new TestConfiguration(), "127.0.0.1", threadIdProvider, timingProvider);
            var action     = new Action(logger, target, "TestRootAction", new SynchronizedQueue <IAction>());
            var testURL    = "127.0.0.1";
            var webRequest = new WebRequestTracerStringURL(target, action, testURL);

            //when
            webRequest.Start().SetBytesSent(-1).Stop(); //stop will add the web request to the beacon

            //then
            Assert.That(target.EventDataList, Is.EquivalentTo(new[] { $"et=30&na={testURL}&it=0&pa=1&s0=2&t0=0&s1=3&t1=0" }));
        }
        public void CanAddReceivedBytesValueZeroToWebRequestTracer()
        {
            //given
            var target        = new Beacon(Substitute.For <ILogger>(), new BeaconCache(), new TestConfiguration(), "127.0.0.1", threadIdProvider, timingProvider);
            var action        = new Action(target, "TestRootAction", new SynchronizedQueue <IAction>());
            var testURL       = "127.0.0.1";
            var webRequest    = new WebRequestTracerStringURL(target, action, testURL);
            var bytesReceived = 0;

            //when
            webRequest.Start().SetBytesReceived(bytesReceived).Stop(); //stop will add the web request to the beacon

            //then
            Assert.That(target.EventDataList, Is.EquivalentTo(new[] { $"et=30&na={testURL}&it=0&pa=1&s0=2&t0=0&s1=3&t1=0&br={bytesReceived}" }));
        }