当前位置: 首页>>代码示例>>C#>>正文


C# StudioResourceRepository.AddItem方法代码示例

本文整理汇总了C#中Dev2.AppResources.Repositories.StudioResourceRepository.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# StudioResourceRepository.AddItem方法的具体用法?C# StudioResourceRepository.AddItem怎么用?C# StudioResourceRepository.AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dev2.AppResources.Repositories.StudioResourceRepository的用法示例。


在下文中一共展示了StudioResourceRepository.AddItem方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StudioResourceRepository_AddItem_ServiceThrowsAnException_ReThrowsAnException

 public void StudioResourceRepository_AddItem_ServiceThrowsAnException_ReThrowsAnException()
 {
     //------------Setup for test--------------------------
     var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
     mockExplorerResourceRepository.Setup(m => m.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
                                   .Throws(new Exception("Something really bad happened, reboot your PC or risk a Harddrive crash"));
     SetupEnvironmentRepo(Guid.Empty);
     var mockVersionRepository = new Mock<IVersionRepository>();
     var repository = new StudioResourceRepository(null, Guid.Empty, _invoke)
     {
         GetVersionProxy = id => mockVersionRepository.Object,
         GetExplorerProxy = id => mockExplorerResourceRepository.Object
     };
     //------------Execute Test---------------------------
     repository.AddItem(new ExplorerItemModel { Parent = new ExplorerItemModel() });
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:16,代码来源:StudioResourceRepositoryTests.cs

示例2: StudioResourceRepository_AddItem_ServiceReturnsAndError_ThrowsAnException

 public void StudioResourceRepository_AddItem_ServiceReturnsAndError_ThrowsAnException()
 {
     //------------Setup for test--------------------------
     var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
     mockExplorerResourceRepository.Setup(m => m.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
                                   .Returns(new ExplorerRepositoryResult(ExecStatus.Fail, "Just Failed"));
     SetupEnvironmentRepo(Guid.Empty);
     var mockVersionRepository = new Mock<IVersionRepository>();
     var repository = new StudioResourceRepository(null, Guid.Empty, _invoke)
     {
         GetVersionProxy = id => mockVersionRepository.Object,
         GetExplorerProxy = id => mockExplorerResourceRepository.Object
     };
     //------------Execute Test---------------------------
     repository.AddItem(new ExplorerItemModel { Parent = new ExplorerItemModel() });
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:16,代码来源:StudioResourceRepositoryTests.cs

示例3: StudioResourceRepository_AddItem_CallsServiceAddItem

 public void StudioResourceRepository_AddItem_CallsServiceAddItem()
 {
     //------------Setup for test--------------------------
     var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
     mockExplorerResourceRepository.Setup(m => m.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
                                   .Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success"))
                                   .Verifiable();
     SetupEnvironmentRepo(Guid.Empty);
     var mockVersionRepository = new Mock<IVersionRepository>();
     var repository = new StudioResourceRepository(null, Guid.Empty, _invoke)
         {
             GetVersionProxy = id => mockVersionRepository.Object,
             GetExplorerProxy = id => mockExplorerResourceRepository.Object
         };
     //------------Execute Test---------------------------
     repository.AddItem(new ExplorerItemModel { Parent = new ExplorerItemModel() });
     //------------Assert Results-------------------------
     mockExplorerResourceRepository.Verify(m => m.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()), Times.Once());
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:19,代码来源:StudioResourceRepositoryTests.cs

示例4: StudioResourceRepository_AddItem_AttachedToParent_AddCalledOnServer

        public void StudioResourceRepository_AddItem_AttachedToParent_AddCalledOnServer()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            mockExplorerResourceRepository.Setup(m => m.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
                                .Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success"));
            var mockVersionRepository = new Mock<IVersionRepository>();
            SetupEnvironmentRepo(Guid.Empty);

            var repository = new StudioResourceRepository(GetTestData(), Guid.Empty, _invoke)
                {
                    GetVersionProxy = id => mockVersionRepository.Object,
                    GetExplorerProxy = id => mockExplorerResourceRepository.Object
                };
            var parent = repository.ExplorerItemModels[0].Children[0];

            var environmentId = Guid.NewGuid();
            var folderId = Guid.NewGuid();

            var folder1 = new ExplorerItemModel
            {
                Parent = parent,
                DisplayName = "subFolder 1",
                EnvironmentId = environmentId,
                Permissions = Permissions.Contribute,
                ResourceId = folderId,
            };
            //------------Execute Test---------------------------
            repository.AddItem(folder1);
            //------------Assert Results-------------------------
            mockExplorerResourceRepository.Verify(m => m.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()), Times.Once());
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:32,代码来源:StudioResourceRepositoryTests.cs

示例5: StudioResourceRepository_AddItem_ItemNotAttachedToParent_ThrowsException

        public void StudioResourceRepository_AddItem_ItemNotAttachedToParent_ThrowsException()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            SetupEnvironmentRepo(Guid.Empty);
            var mockVersionRepository = new Mock<IVersionRepository>();
            var repository = new StudioResourceRepository(null, Guid.Empty, _invoke)
                {
                    GetVersionProxy = id => mockVersionRepository.Object,
                    GetExplorerProxy = id => mockExplorerResourceRepository.Object
                };

            var environmentId = Guid.NewGuid();
            var folderId = Guid.NewGuid();
            var explorerItemModel = new ExplorerItemModel
            {
                DisplayName = "FOLDER 1",
                EnvironmentId = environmentId,
                Permissions = Permissions.Contribute,
                ResourceId = folderId,
            };
            //------------Execute Test---------------------------
            repository.AddItem(explorerItemModel);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:24,代码来源:StudioResourceRepositoryTests.cs

示例6: StudioResourceRepository_AddItem_ItemIsNull_ThrowsException

 public void StudioResourceRepository_AddItem_ItemIsNull_ThrowsException()
 {
     //------------Setup for test--------------------------
     var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
     var mockVersionRepository = new Mock<IVersionRepository>();
     SetupEnvironmentRepo(Guid.Empty);
     var repository = new StudioResourceRepository(GetTestData(), Guid.Empty, _invoke)
         {
             GetVersionProxy = id => mockVersionRepository.Object,
             GetExplorerProxy = id => mockExplorerResourceRepository.Object
         };
     //------------Execute Test---------------------------
     repository.AddItem(null);
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:14,代码来源:StudioResourceRepositoryTests.cs


注:本文中的Dev2.AppResources.Repositories.StudioResourceRepository.AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。