コード例 #1
0
        public void GetWordsToRepeat()
        {
            var words = new List<WordResult>()
            {
                new WordResult() { Word = new Word() { ID = guids[0], Language = Language.En }, LearningSchedule = new List<ScheduleItem>()
                    {
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(-1), IsShown = true },
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(1), IsShown = false }
                    }
                },
                new WordResult() { Word = new Word() { ID = guids[1], Language = Language.En }, LearningSchedule = new List<ScheduleItem>()
                    {
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(-1), IsShown = false },
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(1), IsShown = false }
                    }
                },
                new WordResult() { Word = new Word() { ID = guids[2], Language = Language.En }, LearningSchedule = new List<ScheduleItem>()
                    {
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(1), IsShown = false },
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(2), IsShown = false }
                    }
                },
                new WordResult() { Word = new Word() { ID = guids[3], Language = Language.En }, LearningSchedule = new List<ScheduleItem>()
                    {
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(-1), IsShown = false },
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(-2), IsShown = false }
                    }
                },
                new WordResult() { Word = new Word() { ID = guids[4], Language = Language.Ukr }, LearningSchedule = new List<ScheduleItem>()
                    {
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(-1), IsShown = false },
                        new ScheduleItem() { DateToShow = DateTime.Now.AddDays(-2), IsShown = false }
                    }
                }
            };

            var wordResultStorage = new Mock<IStorage<WordResult>>();
            wordResultStorage.Setup(s => s.AllList).Returns(() => words);
            var wordStorage = new Mock<IWordStorage>();

            var provider = new WordSessionProvider(wordStorage.Object, wordResultStorage.Object, 5, 50);

            var actual = provider.GetWordsToRepeat(Language.En);

            Assert.AreEqual(2, actual.Count());
            Assert.AreEqual(guids[1], actual.First().ID);
            Assert.AreEqual(guids[3], actual.Last().ID);
        }