Example #1
0
        /// <summary>
        /// Returns the currently active project.
        /// </summary>
        /// <returns>
        /// The currently active project.
        /// </returns>
        public ScriptBackEndProjectFacade ActiveProject()
        {
            if (m_Current == null)
            {
                m_Current = new ScriptBackEndProjectFacade(m_Projects.ActiveProject());
            }

            return(m_Current);
        }
        public void OnNameUpdate()
        {
            var project = new Mock<IProject>();
            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            bool eventRaised = false;
            facade.OnNameChanged += (s, e) => { eventRaised = true; };

            project.Raise(p => p.OnNameChanged += null, new ValueChangedEventArgs<string>("newName"));
            Assert.IsTrue(eventRaised);
        }
        public void OnDatasetDeleted()
        {
            var project = new Mock<IProject>();
            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            bool eventRaised = false;
            facade.OnDatasetDeleted += (s, e) => { eventRaised = true; };

            project.Raise(p => p.OnDatasetDeleted += null, EventArgs.Empty);
            Assert.IsTrue(eventRaised);
        }
        public void OnDatasetDeleted()
        {
            var project = new Mock <IProject>();
            var facade  = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            bool eventRaised = false;

            facade.OnDatasetDeleted += (s, e) => { eventRaised = true; };

            project.Raise(p => p.OnDatasetDeleted += null, EventArgs.Empty);
            Assert.IsTrue(eventRaised);
        }
        public void OnSummaryUpdate()
        {
            var project = new Mock <IProject>();
            var facade  = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            bool eventRaised = false;

            facade.OnSummaryChanged += (s, e) => { eventRaised = true; };

            project.Raise(p => p.OnSummaryChanged += null, new ValueChangedEventArgs <string>("newSummary"));
            Assert.IsTrue(eventRaised);
        }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptFrontEndProjectFacade"/> class.
        /// </summary>
        /// <param name="current">The object that describes the current project.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="current"/> is <see langword="null" />.
        /// </exception>
        public ScriptFrontEndProjectFacade(ScriptBackEndProjectFacade current)
        {
            {
                Enforce.Argument(() => current);
            }

            m_Current                   = current;
            m_Current.OnClosed         += (s, e) => RaiseOnProjectClosed();
            m_Current.OnDatasetCreated += (s, e) => RaiseOnDatasetCreated();
            m_Current.OnDatasetDeleted += (s, e) => RaiseOnDatasetDeleted();
            m_Current.OnNameChanged    += (s, e) => RaiseOnProjectNameUpdated();
            m_Current.OnSummaryChanged += (s, e) => RaiseOnProjectSummaryUpdated();
        }
        public void Root()
        {
            var project = new Mock <IProject>();
            {
                project.Setup(p => p.BaseDataset())
                .Returns(new Mock <IProxyDataset>().Object);
            }

            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));
            var root   = facade.Root();

            Assert.IsNotNull(root);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptFrontEndProjectFacade"/> class.
        /// </summary>
        /// <param name="current">The object that describes the current project.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="current"/> is <see langword="null" />.
        /// </exception>
        public ScriptFrontEndProjectFacade(ScriptBackEndProjectFacade current)
        {
            {
                Enforce.Argument(() => current);
            }

            m_Current = current;
            m_Current.OnClosed += (s, e) => RaiseOnProjectClosed();
            m_Current.OnDatasetCreated += (s, e) => RaiseOnDatasetCreated();
            m_Current.OnDatasetDeleted += (s, e) => RaiseOnDatasetDeleted();
            m_Current.OnNameChanged += (s, e) => RaiseOnProjectNameUpdated();
            m_Current.OnSummaryChanged += (s, e) => RaiseOnProjectSummaryUpdated();
        }
        public void Name()
        {
            var project = new Mock<IProject>();
            {
                project.SetupProperty(p => p.Name);
            }

            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            var name = "name";
            facade.Name = name;
            Assert.AreEqual(name, facade.Name);
        }
        public void Summary()
        {
            var project = new Mock <IProject>();
            {
                project.SetupProperty(p => p.Summary);
            }

            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            var summary = "text";

            facade.Summary = summary;
            Assert.AreEqual(summary, facade.Summary);
        }
        public void Name()
        {
            var project = new Mock <IProject>();
            {
                project.SetupProperty(p => p.Name);
            }

            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            var name = "name";

            facade.Name = name;
            Assert.AreEqual(name, facade.Name);
        }
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptBackEndProjectHub"/> class.
        /// </summary>
        /// <param name="projects">The object that handles all the project activities.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="projects"/> is <see langword="null" />.
        /// </exception>
        public ScriptBackEndProjectHub(ILinkToProjects projects)
        {
            {
                Enforce.Argument(() => projects);
            }

            m_Projects = projects;
            {
                m_Projects.OnNewProjectLoaded +=
                    (s, e) =>
                {
                    m_Current = null;
                    RaiseOnNewProjectLoaded();
                };
                m_Projects.OnProjectUnloaded +=
                    (s, e) =>
                {
                    m_Current = null;
                    RaiseOnProjectUnloaded();
                };
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptBackEndProjectHub"/> class.
        /// </summary>
        /// <param name="projects">The object that handles all the project activities.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="projects"/> is <see langword="null" />.
        /// </exception>
        public ScriptBackEndProjectHub(ILinkToProjects projects)
        {
            {
                Enforce.Argument(() => projects);
            }

            m_Projects = projects;
            {
                m_Projects.OnNewProjectLoaded +=
                    (s, e) =>
                    {
                        m_Current = null;
                        RaiseOnNewProjectLoaded();
                    };
                m_Projects.OnProjectUnloaded +=
                    (s, e) =>
                    {
                        m_Current = null;
                        RaiseOnProjectUnloaded();
                    };
            }
        }
        public void Root()
        {
            var project = new Mock<IProject>();
            {
                project.Setup(p => p.BaseDataset())
                    .Returns(new Mock<IProxyDataset>().Object);
            }

            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));
            var root = facade.Root();
            Assert.IsNotNull(root);
        }
        public void Summary()
        {
            var project = new Mock<IProject>();
            {
                project.SetupProperty(p => p.Summary);
            }

            var facade = new ScriptBackEndProjectFacade(new ProjectFacade(project.Object));

            var summary = "text";
            facade.Summary = summary;
            Assert.AreEqual(summary, facade.Summary);
        }
        /// <summary>
        /// Returns the currently active project.
        /// </summary>
        /// <returns>
        /// The currently active project.
        /// </returns>
        public ScriptBackEndProjectFacade ActiveProject()
        {
            if (m_Current == null)
            {
                m_Current = new ScriptBackEndProjectFacade(m_Projects.ActiveProject());
            }

            return m_Current;
        }