Example #1
0
        public void GetAllTasks_Action_Fails()
        {
            // Arrange
            GenericServiceResponse <IEnumerable <TaskDto> > fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.TaskService.GetAllTasks()).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericListViewModel <TaskDto>();

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

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

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericListViewModel <TaskDto>));
            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 <TaskDto>));
            Assert.IsTrue(result.Items.ToList().Count() == 0);
        }
Example #2
0
        public void GetAllTasks1()
        {
            GetAllTasks allTasks = new GetAllTasks();
            var         tasks    = allTasks.Get(connection);

            if (tasks.Count == 100)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail("В таблице не все записи");
            }
        }
Example #3
0
 public object Get(GetAllTasks request)
 {
     return(WithDb(db => Logic.GetAll()));
 }