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

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

            var worstEventFact = new WorstEventFact(_settings);

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

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

            var worstEventFact = new WorstEventFact(_settings);

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

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

            var worstEventFact = new WorstEventFact(_settings);

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

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