public void HomePageViewModel_CloseUpdatePopupVisibilityTest() { TaskHomePageViewModel viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); viewModel.UpdatePopupVisibility = true; viewModel.CloseUpdatePopupCommand.Execute(); Assert.IsFalse(viewModel.UpdatePopupVisibility, "Popup visible"); }
public void HomePageViewModel_UpdatePopupVisibilityTest() { TaskHomePageViewModel viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); viewModel.UpdatePopupVisibility = false; viewModel.TaskItemTappedCommand.Execute(TaskMockData.ReturnDBTaskList()[0]); Assert.IsTrue(viewModel.UpdatePopupVisibility, "Popup not visible"); }
public void HomePageViewModel_AddTask_NoConnection_Test() { TaskHomePageViewModel viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); _platformServiceMock.Setup(method => method.IsConnected()).Returns(false); viewModel.AddTaskCommand.Execute(); Assert.IsTrue(_alertCalled, "alert Failed to call"); }
public void HomePageViewModel_AddTask_EmptyTaskTitleTest() { TaskHomePageViewModel viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); _platformServiceMock.Setup(method => method.IsConnected()).Returns(true); viewModel.AddTaskCommand.Execute(); Assert.IsTrue(_emptyTaskTitleAlertCalled, "Empty alert failed to call"); }
public async Task HomePageViewModel_GetTaskListAsync_NoConnecteciont_Test() { TaskHomePageViewModel viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); _platformServiceMock.Setup(method => method.IsConnected()).Returns(false); await viewModel.GetTaskListAsync(); Assert.AreEqual <int>(viewModel.TaskList.Count, TaskMockData.ReturnServiceTaskList().Count); }
public void HomePageViewModelInitializationTest() { TaskHomePageViewModel viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); Assert.IsTrue(viewModel.IsLoading, "Error Happened when loading"); Assert.AreEqual(viewModel.Title.ToString(), AppConstants.HomePageTitle.ToString(), "TODO::Message"); Assert.IsTrue(Xamarin.Forms.Color.White.Equals(viewModel.WaitingTabColor), "Error in initialization, Initialization not Completed"); Assert.IsTrue(Xamarin.Forms.Color.White.Equals(viewModel.InProgressTabColor), "Error in initialization, Initialization not Completed"); Assert.IsTrue(Xamarin.Forms.Color.White.Equals(viewModel.CompletedTabColor), "Error in initialization, Initialization not Completed"); }
public async Task HomePageViewModel_DeleteTask_SuccessTest() { var viewModel = new TaskHomePageViewModel(_navigationMock.Object, _pageDialogServiceMock.Object); viewModel.TaskList = TaskMockData.ReturnDBTaskList(); _platformServiceMock.Setup(method => method.IsConnected()).Returns(true); await Task.Run(() => { viewModel.DeleteTaskCommand.Execute("1"); }); Assert.IsFalse(_errorAlertCalled, "Delete Task Failed"); }