コード例 #1
0
        public void TestMust_GetListAllDirections()
        {
            //arrange
            var db = new MockSQLite();
            var languageManager = new LanguageManager(db);
            var mockView = new MockDirectionsView();
            var chatHistoryManager = new ChatHistoryManager(db);
            var presenter = new DirectionsPresenter(mockView, new ChatManager(db, languageManager, chatHistoryManager), languageManager);

            //act
            presenter.SelectedAllLanguagesEvent("en");

            //assert
            Assert.GreaterOrEqual(6, mockView.listLanguages.Count, "Количество элементов меньше ожидаемого");
            Assert.IsTrue(mockView.listLanguages.Exists(i => i.NameLocal == "Русский"), "В коллекции нет Русского языка, а должен быть");
            Assert.IsTrue(mockView.listLanguages.Exists(i => i.NameLocal == "English"), "В коллекции нет Английского языка, а должен быть");
        }
コード例 #2
0
        public void TestMust_GetListRecentDirections()
        {
            //arrange
            var db = new MockSQLite();
            var languageManager = new LanguageManager(db);
            var mockView = new MockDirectionsView();
            var chatHistoryManager = new ChatHistoryManager(db);
            var presenter = new DirectionsPresenter(mockView, new ChatManager(db, languageManager, chatHistoryManager), languageManager);

            //act
            presenter.SelectedRecentLanguagesEvent();

            //assert
            Assert.AreEqual(2, mockView.listDirectionsRecent.Count);
            Assert.AreEqual(1, mockView.listDirectionsRecent[0].ChatId);//порядок важен
            Assert.AreEqual(2, mockView.listDirectionsRecent[1].ChatId);//порядок важен
        }
コード例 #3
0
        public void TestMust_FoundCurrentLocaleLanguageAtBottomList()
        {
            //arrange
            var db = new MockSQLite();
            var languageManager = new LanguageManager(db);
            var mockView = new MockDirectionsView();
            var chatHistoryManager = new ChatHistoryManager(db);
            var presenter = new DirectionsPresenter(mockView, new ChatManager(db, languageManager, chatHistoryManager), languageManager);
            string localeLanguage = "ru";

            //act
            presenter.SelectedAllLanguagesEvent(localeLanguage);

            //assert
            Assert.GreaterOrEqual(6, mockView.listLanguages.Count, "Количество элементов меньше ожидаемого");
            Assert.IsTrue(mockView.listLanguages[mockView.listLanguages.Count - 1].NameShort == localeLanguage, "Русский язык должен быть в самом низу списка поскольку это язык локалии");
        }