public void Sets_DomainRoot_To_Point_At_Retrieved_Object()
            {
                XmlDocument.Arrange(x => x.Load(Arg.AnyString)).Returns(XDocument.Parse(ValidDocument));

                Target.GetById("fdsa");

                DomainRoot.Assert(dr => dr.SetRoot(Arg.IsAny <Project>()), Occurs.Once());
            }
            public void Creates_New_Root_If_None_Exists()
            {
                DomainRoot.Arrange(dr => dr.GetRoot()).Returns <IProject>(null);

                Target.SetModules(Mock.Create <IModule>());

                DomainRoot.Assert(dr => dr.SetRoot(Arg.IsAny <Project>()), Occurs.Once());
            }
            public void Does_Not_Overwrite_Existing_Project_When_Root_Is_Not_Null()
            {
                const string projectPath = "asdf";
                var          project     = new Project()
                {
                    ProjectPath = projectPath
                };

                DomainRoot.Arrange(dr => dr.GetRoot()).Returns(new Project());

                Target.Save(project);

                DomainRoot.Assert(dr => dr.SetRoot(Arg.Matches <Project>(p => p.ProjectPath == projectPath)), Occurs.Never());
            }
            public void Sets_Domain_Root_To_Passed_In_Project_When_Root_Is_Null()
            {
                const string projectPath = "asdf";
                var          project     = new Project()
                {
                    ProjectPath = projectPath
                };

                DomainRoot.Arrange(dr => dr.GetRoot()).Returns((Project)null);

                Target.Save(project);

                DomainRoot.Assert(dr => dr.SetRoot(Arg.Matches <Project>(p => p.ProjectPath == projectPath)));
            }