Esempio n. 1
0
        public void ResetDataMarkedForSendingMovesPreviouslyCopiedDataBack()
        {
            // given
            var dataOne   = new BeaconCacheRecord(0L, "One");
            var dataTwo   = new BeaconCacheRecord(0L, "Two");
            var dataThree = new BeaconCacheRecord(1L, "Three");
            var dataFour  = new BeaconCacheRecord(1L, "Four");

            var target = new BeaconCacheEntry();

            target.AddEventData(dataOne);
            target.AddEventData(dataFour);
            target.AddActionData(dataTwo);
            target.AddActionData(dataThree);

            target.CopyDataForSending();

            // when data is reset
            target.ResetDataMarkedForSending();

            // then
            Assert.That(target.EventData, Is.EqualTo(new[] { dataOne, dataFour }));
            Assert.That(target.ActionData, Is.EqualTo(new[] { dataTwo, dataThree }));
            Assert.That(target.EventDataBeingSent, Is.Null);
            Assert.That(target.ActionDataBeingSent, Is.Null);
        }
Esempio n. 2
0
        public void ResetDataMarkedForSendingResetsMarkedForSendingFlag()
        {
            // given
            var dataOne   = new BeaconCacheRecord(0L, "One");
            var dataTwo   = new BeaconCacheRecord(0L, "Two");
            var dataThree = new BeaconCacheRecord(1L, "Three");
            var dataFour  = new BeaconCacheRecord(1L, "Four");

            var target = new BeaconCacheEntry();

            target.AddEventData(dataOne);
            target.AddEventData(dataFour);
            target.AddActionData(dataTwo);
            target.AddActionData(dataThree);

            target.CopyDataForSending();

            // when data is retrieved
            target.GetChunk("", 1024, '&');

            // then all records are marked for sending
            Assert.That(dataOne.IsMarkedForSending, Is.True);
            Assert.That(dataTwo.IsMarkedForSending, Is.True);
            Assert.That(dataThree.IsMarkedForSending, Is.True);
            Assert.That(dataFour.IsMarkedForSending, Is.True);

            // and when
            target.ResetDataMarkedForSending();

            // then
            Assert.That(dataOne.IsMarkedForSending, Is.False);
            Assert.That(dataTwo.IsMarkedForSending, Is.False);
            Assert.That(dataThree.IsMarkedForSending, Is.False);
            Assert.That(dataFour.IsMarkedForSending, Is.False);
        }
Esempio n. 3
0
        public void ResetDataMarkedForSendingReturnsIfDataHasNotBeenCopied()
        {
            // given
            var dataOne   = new BeaconCacheRecord(0L, "One");
            var dataTwo   = new BeaconCacheRecord(0L, "Two");
            var dataThree = new BeaconCacheRecord(1L, "Three");
            var dataFour  = new BeaconCacheRecord(1L, "Four");

            var target = new BeaconCacheEntry();

            target.AddEventData(dataOne);
            target.AddEventData(dataFour);
            target.AddActionData(dataTwo);
            target.AddActionData(dataThree);

            // when
            target.ResetDataMarkedForSending();

            // then
            Assert.That(target.EventData, Is.EqualTo(new[] { dataOne, dataFour }));
            Assert.That(target.ActionData, Is.EqualTo(new[] { dataTwo, dataThree }));
            Assert.That(target.EventDataBeingSent, Is.Null);
            Assert.That(target.ActionDataBeingSent, Is.Null);
        }