Esempio n. 1
0
        public IFixtureOverview GetFixtureOverview(string fixtureId)
        {
            FixtureOverview fixtureOverview = null;

            return(_fixtures.TryGetValue(fixtureId, out fixtureOverview)
                ? fixtureOverview
                : _fixtures[fixtureId] = new FixtureOverview(fixtureId));
        }
Esempio n. 2
0
        private FixtureOverview GetFixtureOverview(string fixtureId)
        {
            FixtureOverview fixtureOverview;

            return(_fixturesOverview.TryGetValue(fixtureId, out fixtureOverview)
                ? fixtureOverview
                : _fixturesOverview[fixtureId] = new FixtureOverview(fixtureId));
        }
        private void PublishDelta(FixtureOverview fixtureOverview)
        {
            var delta = fixtureOverview.GetDelta();

            if (delta != null)
            {
                _fixtureTracker.OnNext(delta);
            }
        }
 private static void UpdateLastErrorResolved(StreamListenerEventArgs streamListenerEventArgs,
                                             FixtureOverview fixtureOverview)
 {
     if (fixtureOverview.LastError != null &&
         fixtureOverview.LastError.IsErrored &&
         !streamListenerEventArgs.Listener.IsErrored)
     {
         fixtureOverview.LastError.ResolvedAt = DateTime.UtcNow;
         fixtureOverview.LastError.IsErrored  = false;
     }
 }
        private void CleanUpFixtureData(string fixtureId)
        {
            var fixtureState = EventState.GetFixtureState(fixtureId);

            FixtureOverview tempObj = null;

            _fixtures.TryRemove(fixtureId, out tempObj);

            if (fixtureState != null && fixtureState.MatchStatus == MatchStatus.MatchOver)
            {
                SaveState();
            }
        }
        public void GetDeltaHasNotChangedTest()
        {
            var fixtureOverview = new FixtureOverview("TestId");

            fixtureOverview.ListenerOverview.IsStreaming = true;

            //initial set up will also create a delta this call clears it
            fixtureOverview.GetDelta();

            fixtureOverview.ListenerOverview.IsStreaming = true;
            var delta = fixtureOverview.GetDelta();
            delta.Should().BeNull();
        }
Esempio n. 7
0
        public void GetDeltaHasNotChangedTest()
        {
            var fixtureOverview = new FixtureOverview("TestId");

            fixtureOverview.ListenerOverview.IsStreaming = true;

            //initial set up will also create a delta this call clears it
            fixtureOverview.GetDelta();

            fixtureOverview.ListenerOverview.IsStreaming = true;
            var delta = fixtureOverview.GetDelta();

            delta.Should().BeNull();
        }
        public void GetDeltaTest()
        {
            var fixtureOverview = new FixtureOverview("TestId");

            fixtureOverview.ListenerOverview.IsStreaming = false;

            fixtureOverview.ListenerOverview.IsStreaming = true;

            var delta = fixtureOverview.GetDelta();
            delta.Should().NotBeNull();
            delta.ListenerOverview.Should().NotBeNull();
            delta.ListenerOverview.IsStreaming.HasValue.Should().BeTrue();
            delta.Id.Should().Be(fixtureOverview.Id);

            //hasn't changed
            delta.ListenerOverview.IsDeleted.HasValue.Should().BeFalse();
        }
Esempio n. 9
0
        public void GetDeltaTest()
        {
            var fixtureOverview = new FixtureOverview("TestId");

            fixtureOverview.ListenerOverview.IsStreaming = false;

            fixtureOverview.ListenerOverview.IsStreaming = true;

            var delta = fixtureOverview.GetDelta();

            delta.Should().NotBeNull();
            delta.ListenerOverview.Should().NotBeNull();
            delta.ListenerOverview.IsStreaming.HasValue.Should().BeTrue();
            delta.Id.Should().Be(fixtureOverview.Id);

            //hasn't changed
            delta.ListenerOverview.IsDeleted.HasValue.Should().BeFalse();
        }
Esempio n. 10
0
        public void GetErrorTest()
        {
            var fixtureOverview = new FixtureOverview("TestId");

            fixtureOverview.LastError = new ErrorOverview
            {
                ErroredAt = DateTime.UtcNow,
                Exception = new NullReferenceException(),
                IsErrored = true,
            };

            var delta = fixtureOverview.GetDelta();

            delta.LastError.Should().NotBeNull();
            delta.LastError.Should().Be(fixtureOverview.LastError);

            fixtureOverview.ListenerOverview.IsErrored = false;

            delta = fixtureOverview.GetDelta();
            delta.LastError.Should().NotBeNull();
            delta.LastError.ResolvedAt.HasValue.Should().BeTrue();
        }
        public void GetErrorTest()
        {
            var fixtureOverview = new FixtureOverview("TestId");

            fixtureOverview.LastError = new ErrorOverview
            {
                ErroredAt = DateTime.UtcNow,
                Exception = new NullReferenceException(),
                IsErrored = true,

            };

            var delta = fixtureOverview.GetDelta();
            delta.LastError.Should().NotBeNull();
            delta.LastError.Should().Be(fixtureOverview.LastError);

            fixtureOverview.ListenerOverview.IsErrored = false;

            delta = fixtureOverview.GetDelta();
            delta.LastError.Should().NotBeNull();
            delta.LastError.ResolvedAt.HasValue.Should().BeTrue();
        }
Esempio n. 12
0
 public IFixtureOverview GetFixtureOverview(string fixtureId)
 {
     return _fixtures.ContainsKey(fixtureId) ? _fixtures[fixtureId] : _fixtures[fixtureId] = new FixtureOverview(fixtureId);
 }
Esempio n. 13
0
 private static void UpdateLastErrorResolved(StreamListenerEventArgs streamListenerEventArgs,
     FixtureOverview fixtureOverview)
 {
     if (fixtureOverview.LastError != null
         && fixtureOverview.LastError.IsErrored
         && !streamListenerEventArgs.Listener.IsErrored)
     {
         fixtureOverview.LastError.ResolvedAt = DateTime.UtcNow;
         fixtureOverview.LastError.IsErrored = false;
     }
 }
Esempio n. 14
0
 private void PublishDelta(FixtureOverview fixtureOverview)
 {
     var delta = fixtureOverview.GetDelta();
     if (delta != null)
         _fixtureTracker.OnNext(delta);
 }
Esempio n. 15
0
 public IFixtureOverview GetFixtureOverview(string fixtureId)
 {
     return(_fixtures.ContainsKey(fixtureId) ? _fixtures[fixtureId] : _fixtures[fixtureId] = new FixtureOverview(fixtureId));
 }