void OpenProjectById(Guid projectId) { NewProjectUseCase newProjectUseCase = this.Container.Resolve <NewProjectUseCase>(); newProjectUseCase.ProjectId = projectId; ApplicationModel.AddMainUseCase(newProjectUseCase); ApplicationModel.ActivateUseCase(newProjectUseCase); }
void OpenResourceById(int resourceId) { NewResourceUseCase newResourceUseCase = this.Container.Resolve <NewResourceUseCase>(); newResourceUseCase.ResourceId = resourceId; ApplicationModel.AddMainUseCase(newResourceUseCase); ApplicationModel.ActivateUseCase(newResourceUseCase); }
public void SettingActiveOnUseCaseWillSetActiveUseCase() { ApplicationModel applicationModel = CreateApplicationModel(); IActiveAwareUseCaseController mockUseCase1 = new MockUseCase(); IActiveAwareUseCaseController mockUseCase2 = new MockUseCase(); applicationModel.AddMainUseCase(mockUseCase1); applicationModel.AddMainUseCase(mockUseCase2); Assert.IsFalse(mockUseCase1.IsActive); Assert.AreEqual(0, applicationModel.ActiveUseCases.Count()); mockUseCase1.IsActive = true; Assert.AreEqual(mockUseCase1, applicationModel.ActiveUseCases.FirstOrDefault()); Assert.IsTrue(mockUseCase1.IsActive); Assert.IsFalse(mockUseCase2.IsActive); mockUseCase2.IsActive = true; Assert.AreEqual(mockUseCase2, applicationModel.ActiveUseCases.FirstOrDefault()); Assert.IsFalse(mockUseCase1.IsActive); Assert.IsTrue(mockUseCase2.IsActive); }
public void ActivatingOneUseCaseDeactivatesOther() { ApplicationModel applicationModel = CreateApplicationModel(); IActiveAwareUseCaseController mockUseCase1 = new MockUseCase(); IActiveAwareUseCaseController mockUseCase2 = new MockUseCase(); applicationModel.AddMainUseCase(mockUseCase1); applicationModel.AddMainUseCase(mockUseCase2); Assert.IsFalse(mockUseCase1.IsActive); Assert.AreEqual(0, applicationModel.ActiveUseCases.Count()); applicationModel.ActivateUseCase(mockUseCase1); Assert.AreEqual(mockUseCase1, applicationModel.ActiveUseCases.FirstOrDefault()); Assert.IsTrue(mockUseCase1.IsActive); applicationModel.ActivateUseCase(mockUseCase2); Assert.AreEqual(mockUseCase2, applicationModel.ActiveUseCases.FirstOrDefault()); Assert.IsTrue(mockUseCase2.IsActive); Assert.IsFalse(mockUseCase1.IsActive); }
public void CallingActivateCommandActivatesUseCase() { ApplicationModel applicationModel = CreateApplicationModel(); IActiveAwareUseCaseController mockUseCase1 = new MockUseCase(); applicationModel.AddMainUseCase(mockUseCase1); Assert.IsFalse(mockUseCase1.IsActive); Assert.AreEqual(0, applicationModel.ActiveUseCases.Count()); applicationModel.ActivateUseCaseCommand.Execute(mockUseCase1); Assert.AreEqual(mockUseCase1, applicationModel.ActiveUseCases.FirstOrDefault()); Assert.IsTrue(mockUseCase1.IsActive); }