コード例 #1
0
 public void InitializeContext()
 {
     this.uriService = new Mock<IUriReferenceService>();
     this.currentElement = new Mock<IProductElement>();
     this.command = new DeleteArtifactsCommand
         {
             CurrentElement = this.currentElement.Object,
             UriReferenceService = this.uriService.Object,
             Solution = new Mock<ISolution>().Object,
             SolutionSelector = new Mock<ISolutionSelector>().Object,
         };
 }
コード例 #2
0
            public void InitializeContext()
            {
                this.projectItem = new Mock<ProjectItem>();
                this.solutionItem = new Mock<IItem>();
                this.solutionItem.Setup(si => si.Name).Returns("foo.cs");
                this.solutionItem.Setup(si => si.As<EnvDTE.ProjectItem>()).Returns(this.projectItem.Object);
                this.uriService = new Mock<IUriReferenceService>();
                this.uriService.Setup(us => us.ResolveUri<IItemContainer>(It.IsAny<Uri>())).Returns(solutionItem.Object);
                this.currentElement = new Mock<IProductElement>();

                this.currentElement.Setup(ce => ce.References).Returns(new[]
                {
                    Mock.Of<IReference>(re => 
                        re.Kind == typeof(SolutionArtifactLinkReference).FullName 
                        && re.Value == "solution://foo"
                        && re.Tag =="foo"),
                    Mock.Of<IReference>(re => 
                        re.Kind == typeof(SolutionArtifactLinkReference).FullName 
                        && re.Value == "solution://bar"
                        && re.Tag =="bar")
                });

                this.command = new DeleteArtifactsCommand
                {
                    Action = DeleteAction.DeleteAll,
                    CurrentElement = this.currentElement.Object,
                    UriReferenceService = this.uriService.Object,
                    Solution = new Mock<ISolution>().Object,
                    SolutionSelector = new Mock<ISolutionSelector>().Object,
                };
            }