private MainViewModel PrepareMainViewModel(ClientStorage clientStorage, ProjectStorage projectStorage)
 {
     var clientListViewModel = new ClientListViewModel(clientStorage);
     var projectListViewModel = new ProjectListViewModel(projectStorage);
     var mainViewModel = new MainViewModel(clientListViewModel, projectListViewModel);
     return mainViewModel;
 }
 public NewProjectViewModel(ProjectListViewModel parent)
 {
     this.parent = parent;
     project = new Project {ClientName = "", Name = "", Status = ""};
     avaliableStatusList = AvaliableProjectStatus.GetAvaliableStatusList();
     EndDate = "No end date";
     if (project.EndDate == "No end date") {
         AvaliableStatusList.Remove("Закончен");
     }
     addNewProjectDialogVisible = "Hidden";
     Status = AvaliableStatusList.First();
 }
 public ProjectViewModel(Project project, ProjectListViewModel parent)
 {
     this.project = project;
     this.parent = parent;
     avaliableStatusList = AvaliableProjectStatus.GetAvaliableStatusList();
     if (string.IsNullOrEmpty(project.EndDate) || string.IsNullOrWhiteSpace(project.EndDate)) {
         EndDate = "No end date";
     }
     ShowStatusChangeControls = new Command(OnShowStatusChangeControls);
     ShowDisplayStatusControls = new Command(OnShowDisplayStatusControls);
     statusChangeMode = "Hidden";
     statusDisplayMode = "Visible";
 }
        public void RemoveProjectFromStorageWhenClickRemoveButton()
        {
            var projectForRemove = new Project {
                Name = "Name 1",
                ClientName = "Client 1",
                Status = "Status 1"
            };
            projectStorage.AddProject(projectForRemove);
            projectListViewModel = Open();

            projectListViewModel.Projects.Single().Remove.Execute(null);

            Assert.IsFalse(IsProjectStorageContainProject(projectForRemove));
        }
        public void AddClientToStorageWhenClickAddButton()
        {
            var projectForAdd = new Project {
                Name = "Name 1",
                ClientName = "Client 1",
                Status = "Status 1"
            };
            projectListViewModel = Open();
            InsertNewClientData(projectForAdd);

            projectListViewModel.NewProject.Add.Execute(null);

            Assert.IsTrue(IsProjectStorageContainProject(projectForAdd));
        }
 public MainViewModel(ClientListViewModel clientListViewModel, ProjectListViewModel projectListViewModel)
 {
     ClientList = clientListViewModel;
     ProjectList = projectListViewModel;
 }