public void ShouldThrowWExcepionWhenDataIsInvalid()
            {
                var data = new ExtensionDataModel(this.service, this.vshelper, null)
                               {
                                   AssociatedProject = new Resource(),
                                   ServerAnalysis = ExtensionDataModel.AnalysesType.Server,
                                   Issues = new List<Issue> { new Issue(), new Issue() }
                               };

                data.UpdateIssuesLocationWithModifiedBuffer("data");
                Assert.AreEqual("Error Updating Locations Off Issues", data.ErrorMessage);
                Assert.AreEqual(0, data.IssuesInEditor.Count);
            }
            public void DoServerAnalysisUpdateBufferFileFound()
            {
                var source = new Source { Lines = new List<Line> { new Line { Id = 1, Val = "#include xpto;" }, new Line { Id = 2, Val = "#include ypto;" } } };

                this.vshelper.Expect(
                    mp => mp.CurrentSelectedDocumentLanguage())
                    .Return("c++");
                this.vshelper.Expect(
                    mp => mp.ActiveFileFullPath())
                    .Return("c:\\src\\file.cpp");
                this.vshelper.Expect(
                    mp => mp.ActiveSolutionPath())
                    .Return("c:\\src");
                this.service.Expect(
                    mp => mp.GetSourceForFileResource(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Anything))
                    .Return(source);
                var element = new Resource { Date = new DateTime(2000, 1, 1), Key = "resourceKey", Lname = "file.cpp" };
                this.service.Expect(
                    mp => mp.GetResourcesData(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Anything))
                    .Return(new List<Resource> { element })
                    .Repeat.Times(3);
                this.service.Expect(
                    mp => mp.GetIssuesInResource(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Anything, Arg<bool>.Is.Anything))
                    .Return(new List<Issue> { new Issue { Component = "file.cpp", Line = 1, Status = "OPEN" }, new Issue { Component = "file.cpp", Line = 1, Status = "OPEN" } })
                    .Repeat.Once();
                this.pluginController.Expect(
                    mp => mp.GetPluginToRunResource(Arg<string>.Is.Anything))
                    .Return(this.plugin)
                    .Repeat.Once();

                this.plugin.Expect(mp => mp.IsSupported(Arg<string>.Is.Anything)).Return(true).Repeat.Once();
                this.plugin.Expect(mp => mp.GetServerAnalyserExtension()).Return(this.extension).Repeat.Once();
                this.extension.Expect(
                    mp =>
                    mp.GetResourceKey(
                        Arg<string>.Is.Anything,
                        Arg<VsProjectItem>.Is.Anything,
                        Arg<string>.Is.Anything,
                        Arg<string>.Is.Anything)).Return("key").Repeat.Once();

                var data = new ExtensionDataModel(this.service, this.vshelper, null);
                data.PluginController = this.pluginController;
                data.PluginRunningAnalysis = this.plugin;
                data.ServerAnalysis = ExtensionDataModel.AnalysesType.Server;
                data.AssociatedProject = new Resource { Key = "KEY", Lname = "file.cpp"};
                data.UpdateDataInEditor("c:\\src\\file.cpp", "#include xpto;\r\n#include ypto;");
                Assert.AreEqual(string.Empty, data.ErrorMessage);
                Assert.AreEqual(2, data.IssuesInEditor.Count);
                data.UpdateIssuesLocationWithModifiedBuffer("#include xpto;\r\n#include ypto;");
                Assert.AreEqual(string.Empty, data.ErrorMessage);
                Assert.AreEqual(2, data.IssuesInEditor.Count);
            }
 public void ShouldReturnWhenContstrainsAreNotMet()
 {
     var data = new ExtensionDataModel(this.service, this.vshelper, null);
     data.ServerAnalysis = ExtensionDataModel.AnalysesType.Off;
     data.UpdateIssuesLocationWithModifiedBuffer("data");
     Assert.AreEqual(string.Empty, data.ErrorMessage);
     Assert.AreEqual(0, data.IssuesInEditor.Count);
     data.ServerAnalysis = ExtensionDataModel.AnalysesType.Server;
     data.UpdateIssuesLocationWithModifiedBuffer("data");
     Assert.AreEqual(0, data.IssuesInEditor.Count);
     Assert.IsNull(data.ResourceInEditor);
 }