示例#1
0
        public void AddStreamToCompleteProjectThrowsException()
        {
            var projectManager = new ProjectManager {
                Session = _embeddedDocStore.OpenSession()
            };
            var          newProjectStream = new ProjectStream("Stream1", "Create a new stream that takes over the whole project.");
            const string exceptionMessage = "Cannot add stream to project with status of Complete.";

            Assert.That(() => projectManager.AddProjectStream(completedProject.Name, newProjectStream, activeUser.Username), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage));
        }
示例#2
0
        public void AddStreamToActiveProjectUserNotInProjectThrowsException()
        {
            var projectManager = new ProjectManager {
                Session = _embeddedDocStore.OpenSession()
            };
            var newProjectStream = new ProjectStream("Stream1", "Create a new stream that takes over the whole project.");
            var exceptionMessage = string.Format("User {0} is currently not active in Project {1}.", activeUserNotInProject.Username, activeProject.Name);

            Assert.That(() => projectManager.AddProjectStream(activeProject.Name, newProjectStream, activeUserNotInProject.Username), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage));
        }
示例#3
0
        public void AddStreamToActiveProjectSuccess()
        {
            var projectManager = new ProjectManager {
                Session = _embeddedDocStore.OpenSession()
            };
            var newProjectStream = new ProjectStream("Stream1", "Create a new stream that takes over the whole project.");

            projectManager.AddProjectStream(activeProject.Name, newProjectStream, activeUser.Username);
            var session = _embeddedDocStore.OpenSession();
            var project = session.Query <Project>().Where(p => p.Name == activeProject.Name).First();

            Assert.That(project.ProjectStreams.Count, Is.EqualTo(1));
            Assert.That(project.ProjectStreams[0].CreatedBy, Is.EqualTo(activeUser.Username));
        }
        public PartialViewResult Create(FormCollection collection)
        {
            try
            {
                var streamName = collection["name"];
                var description = collection["description"];
                var projectName = collection["projectName"];
                var projectStream = new ProjectStream(streamName, description);

                var projectManager = new ProjectManager { Session = RavenSession };
                projectManager.AddProjectStream(projectName, projectStream, User.Identity.Name);
                return Details(projectName, streamName);
                // return RedirectToAction("Details", new { projectName = projectName, streamName = projectStream.Name});
            }
            catch(Exception e)
            {
                throw;
            }
        }
示例#5
0
        public PartialViewResult Create(FormCollection collection)
        {
            try
            {
                var streamName    = collection["name"];
                var description   = collection["description"];
                var projectName   = collection["projectName"];
                var projectStream = new ProjectStream(streamName, description);

                var projectManager = new ProjectManager {
                    Session = RavenSession
                };
                projectManager.AddProjectStream(projectName, projectStream, User.Identity.Name);
                return(Details(projectName, streamName));
                // return RedirectToAction("Details", new { projectName = projectName, streamName = projectStream.Name});
            }
            catch (Exception e)
            {
                throw;
            }
        }