public void OnMapEntryTest() { bool wasExceptions = false; bool wasExceptions2 = false; bool wasNotificated = false; _adminNotification.Setup(a => a.MapEntryNotificate()).Callback(() => { wasNotificated = true; }); _currentProject.WorkflowState.CurrentState = ProjectWorkflow.State.OnMap; OnMapUoW target = CreateUoW(); try { target.OnMapEntry(); } catch (InvalidOperationException e) { wasExceptions = true; } _currentProject.Address = new Address { Lat = 2, Lng = 3 }; target = CreateUoW(); try { target.OnMapEntry(); } catch (InvalidOperationException e) { wasExceptions2 = true; } _currentProject.Address = new Address { Lat = 54.2807765015195, Lng = 30.9715922176838 }; _currentProject.WorkflowState.CurrentState = ProjectWorkflow.State.Open; target = CreateUoW(); target.OnMapEntry(); Assert.IsTrue(wasExceptions); Assert.IsTrue(wasExceptions2); Assert.IsTrue( _repository.GetOne <Project>( p => p._id == _currentProject._id).WorkflowState.CurrentState == ProjectWorkflow.State.OnMap); Assert.IsTrue(_repository.GetOne <Project>( p => p._id == _currentProject._id).WorkflowState.History.Count > 0); Assert.IsTrue(_repository.GetOne <Project>( p => p._id == _currentProject._id) .WorkflowState.History.Find( h => h.Editor == _userName && h.From == ProjectWorkflow.State.Open && h.To == ProjectWorkflow.State.OnMap) != null); Assert.IsTrue(wasNotificated); }
public void FromOnComissionToOnMapTest() { OnMapUoW target = CreateUoW(); Assert.IsFalse(target.FromOnComissionToOnMap()); _roles = new[] { "Admin" }; target = CreateUoW(); Assert.IsTrue(target.FromOnComissionToOnMap()); }
public void FromWaitIspolcomFixesToOnMapTest() { OnMapUoW target = CreateUoW(); Assert.IsFalse(target.FromWaitIspolcomFixesToOnMap()); _roles = new[] { "Admin" }; target = CreateUoW(); Assert.IsTrue(target.FromWaitIspolcomFixesToOnMap()); }
public void FromOnMapToInvestorApproveTest() { OnMapUoW target = CreateUoW(); Assert.IsTrue(target.FromOnMapToInvestorApprove()); _currentProject.Responses = new List <InvestorResponse> { new InvestorResponse() }; target = CreateUoW(); Assert.IsTrue(target.FromOnMapToInvestorApprove()); }
public void OnMapUoWConstructorTest() { OnMapUoW target = CreateUoW(); Assert.IsNotNull(target); }
public UnitsOfWorkContainer(Project currentProject, IRepository repository, IUserNotification userNotification, IAdminNotification adminNotification, IInvestorNotification investorNotification, string userName, IEnumerable <string> roles) { _currentProject = currentProject; _repository = repository; _userNotification = userNotification; _adminNotification = adminNotification; _investorNotification = investorNotification; _userName = userName; _roles = roles; OpenUoW = new OpenUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); OnMapUoW = new OnMapUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); InvestorApproveUoW = new InvestorApproveUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); WaitIspolcomUoW = new WaitIspolcomUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); WaitInvolvedUoW = new WaitInvolvedUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); WaitComissionUoW = new WaitComissionUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); RealizationUoW = new RealizationUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); PlanCreatingUoW = new PlanCreatingUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); OnIspolcomUoW = new OnIspolcomUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); OnComissionUoW = new OnComissionUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); MinEconomyUoW = new MinEconomyUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); IspolcomFixesUoW = new IspolcomFixesUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); InvolvedorganizationsUoW = new InvolvedOrganizationsUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); DocumentSendingUoW = new DocumentSendingUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); ComissionFixesUoW = new ComissionFixesUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); DoneUoW = new DoneUoW(_currentProject, _repository, _userNotification, _adminNotification, _investorNotification, _userName, _roles); var dict = new Dictionary <Type, IState>(); dict.Add(OnMapUoW.GetType(), OnMapUoW); AttributeStateMachineBuilder.InitializeStates(dict); }