Example #1
0
        public void Process_TwoEventsWithMaximumRating_ReturnApplicableFact()
        {
            // arrange
            _settings = new ItHappenedSettings(
                new TrackSettingsForRatingFacts(
                    3,
                    30,
                    7),
                null, null);

            events.Add(new Event(
                           Guid.NewGuid(),
                           DateTime.Now - TimeSpan.FromDays(20),
                           Guid.NewGuid(),
                           new Customizations(new CustomizationsDto()
            {
                Rating = 7
            },
                                              new List <CustomizationType>()
            {
                CustomizationType.Rating
            })));

            var bestEventFact = new BestEventFact(_settings);

            // act
            bestEventFact.Process(events, trackName);

            // assert
            Assert.IsTrue(bestEventFact.IsApplicable);
            Assert.AreEqual(
                $"Событие TestTrack с самым высоким рейтингом 7 произошло {events[3].CreatedAt.ToString()}",
                bestEventFact.Description);
        }
Example #2
0
        public void Process_DaysSinceEarliestEventNotSatisfyRequiredCondition_ReturnNotApplicableFact()
        {
            // arrange
            _settings = new ItHappenedSettings(
                new TrackSettingsForRatingFacts(
                    3,
                    60,
                    5),
                null, null);

            var bestEventFact = new BestEventFact(_settings);

            // act
            bestEventFact.Process(events, trackName);

            // assert
            Assert.IsFalse(bestEventFact.IsApplicable);
        }
Example #3
0
        public void Process_ReturnApplicableFactForCorrectData()
        {
            // arrange
            _settings = new ItHappenedSettings(
                new TrackSettingsForRatingFacts(
                    3,
                    30,
                    5),
                null, null);

            var bestEventFact = new BestEventFact(_settings);

            // act
            bestEventFact.Process(events, trackName);

            // assert
            Assert.IsTrue(bestEventFact.IsApplicable);
            Assert.AreEqual(7, bestEventFact.Priority);
            Assert.AreEqual(
                $"Событие TestTrack с самым высоким рейтингом 7 произошло {events[2].CreatedAt.ToString()}",
                bestEventFact.Description);
        }