コード例 #1
0
        public void GetAllLanguages_Action_Fails()
        {
            // Arrange
            GenericServiceResponse <IEnumerable <LanguageDto> > fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.LanguageService.GetAllLanguages()).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericListViewModel <LanguageDto>();

            var action = new GetAllLanguages <GenericListViewModel <LanguageDto> >(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericListViewModel <LanguageDto>));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Items);
            Assert.IsTrue(result.Items.Count() == 0);
            Assert.IsInstanceOfType(result.Items, typeof(IEnumerable <LanguageDto>));
            Assert.IsTrue(result.Items.ToList().Count() == 0);
        }
コード例 #2
0
        private void UpdateLanguages()
        {
            Languages.Elements.Clear();
            List <string> lngs = GetAllLanguages?.Invoke();

            foreach (var l in lngs)
            {
                ConsoleListElement cle = new ConsoleListElement(Languages, l, ConsoleColor.Blue);
                cle.OnClick += Language_OnClick;
                Languages.Elements.Add(cle);
            }
        }
コード例 #3
0
 public List <string> GetAllLanguagesInvoker()
 => GetAllLanguages?.Invoke();