Beispiel #1
0
            public Mock <SelectedItem> AddSelectedItem(string fileName, bool isLink = false)
            {
                var name           = Path.GetFileName(fileName);
                var propertiesFake = new PropertiesFake();
                var path           = Path.GetDirectoryName(this.ProjectFullName);

                propertiesFake.AddProperty("IsLink", isLink);

                var projectItem = Mock.Of <ProjectItem>(x =>
                                                        x.get_FileNames(0) == Path.Combine(path, fileName) &&
                                                        x.Name == name &&
                                                        x.Properties == propertiesFake &&
                                                        x.ContainingProject == this.ProjectMock.Object);

                var selectedItem = Mock.Of <SelectedItem>(x =>
                                                          x.Name == name &&
                                                          x.ProjectItem == projectItem);

                this.selectedItems.AddIndexedItem(selectedItem);

                return(Mock.Get(selectedItem));
            }
Beispiel #2
0
            private void OnBeforeInit(object sender, EventArgs e)
            {
                var propertiesFake = new PropertiesFake();

                propertiesFake.AddProperty("FullPath", Path.GetDirectoryName(this.ProjectFullName) + @"\");

                this.ProjectMock
                .SetupGet(x => x.FullName)
                .Returns(() => this.ProjectFullName);

                this.ProjectMock
                .SetupGet(x => x.Properties)
                .Returns(propertiesFake);

                this.EnvironmentMock
                .SetupGet(x => x.SelectedItems)
                .Returns(this.selectedItems);

                this.GetMock <IVisualStudioJSLintProvider>()
                .Setup(x => x.LoadSettings(It.IsAny <Project>()))
                .Returns(this.Settings);
            }
                protected override void BeforeResolve()
                {
                    base.BeforeResolve();

                    this.GetMock <IVisualStudioJSLintProvider>()
                    .Setup(x => x.LoadSettings(It.IsAny <Project>()))
                    .Returns(this.Settings);

                    this.ProjectMock
                    .SetupGet(x => x.FullName)
                    .Returns(@"project path\project.csproj");

                    this.ProjectPropertiesFake.AddProperty("FullPath", @"project path\");

                    this.ProjectMock
                    .SetupGet(x => x.Properties)
                    .Returns(this.ProjectPropertiesFake);

                    this.ProjectItemMock
                    .SetupGet(x => x.ContainingProject)
                    .Returns(this.ProjectMock.Object);

                    this.ProjectItemMock
                    .Setup(x => x.get_FileNames(It.IsAny <short>()))
                    .Returns(() => this.DocumentFullName);

                    var properties = new PropertiesFake();

                    properties.AddProperty("IsLink", false);

                    this.ProjectItemMock
                    .SetupGet(x => x.Properties)
                    .Returns(properties);

                    this.DocumentMock
                    .SetupGet(x => x.ProjectItem)
                    .Returns(this.ProjectItemMock.Object);
                }
Beispiel #4
0
            protected override void BeforeResolve()
            {
                base.BeforeResolve();

                var propertiesFake = new PropertiesFake();

                propertiesFake.AddProperty("FullPath", Path.GetDirectoryName(this.ProjectFullName) + @"\");

                this.ProjectMock
                .SetupGet(x => x.FullName)
                .Returns(() => this.ProjectFullName);

                this.ProjectMock
                .SetupGet(x => x.Properties)
                .Returns(propertiesFake);

                this.EnvironmentMock
                .SetupGet(x => x.SelectedItems)
                .Returns(this.selectedItems);

                this.GetMock <IVisualStudioJSLintProvider>()
                .Setup(x => x.LoadSettings(It.IsAny <Project>()))
                .Returns(this.Settings);
            }
Beispiel #5
0
                private void OnBeforeInit(object sender, System.EventArgs e)
                {
                    this.GetMock <IVisualStudioJSLintProvider>()
                    .Setup(x => x.LoadSettings(It.IsAny <Project>()))
                    .Returns(this.Settings);

                    this.ProjectMock
                    .SetupGet(x => x.FullName)
                    .Returns(@"project path\project.csproj");

                    this.ProjectPropertiesFake.AddProperty("FullPath", @"project path\");

                    this.ProjectMock
                    .SetupGet(x => x.Properties)
                    .Returns(this.ProjectPropertiesFake);

                    this.ProjectItemMock
                    .SetupGet(x => x.ContainingProject)
                    .Returns(this.ProjectMock.Object);

                    this.ProjectItemMock
                    .Setup(x => x.get_FileNames(It.IsAny <short>()))
                    .Returns(() => this.DocumentFullName);

                    var properties = new PropertiesFake();

                    properties.AddProperty("IsLink", false);

                    this.ProjectItemMock
                    .SetupGet(x => x.Properties)
                    .Returns(properties);

                    this.DocumentMock
                    .SetupGet(x => x.ProjectItem)
                    .Returns(this.ProjectItemMock.Object);
                }