本文整理汇总了C#中Dev2.AppResources.Repositories.StudioResourceRepository.FindItemById方法的典型用法代码示例。如果您正苦于以下问题:C# StudioResourceRepository.FindItemById方法的具体用法?C# StudioResourceRepository.FindItemById怎么用?C# StudioResourceRepository.FindItemById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dev2.AppResources.Repositories.StudioResourceRepository
的用法示例。
在下文中一共展示了StudioResourceRepository.FindItemById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StudioResourceRepository_DeleteItem_ItemParentNull_Exception
public void StudioResourceRepository_DeleteItem_ItemParentNull_Exception()
{
//------------Setup for test--------------------------
var _propertyChangedCalled = false;
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
mockExplorerResourceRepository.Setup(m => m.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
.Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success"))
.Verifiable();
var environmentId = Guid.NewGuid();
var workflowId = Guid.NewGuid();
var folderID = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var mockVersionRepository = new Mock<IVersionRepository>();
var repository = new StudioResourceRepository(GetTestData(workflowId.ToString(), folderID: folderID), environmentId, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object
};
var folderItem = repository.FindItemById(folderID);
ExplorerItemModel item = folderItem.Parent as ExplorerItemModel;
// ReSharper disable PossibleNullReferenceException
item.PropertyChanged += (sender, args) =>
// ReSharper restore PossibleNullReferenceException
{
if(args.PropertyName == "ChildrenCount")
{
_propertyChangedCalled = true;
}
};
//------------Execute Test---------------------------
ExplorerItemModel explorerItemModel = new ExplorerItemModel();
repository.DeleteItem(explorerItemModel);
//------------Assert Results-------------------------
Assert.IsFalse(_propertyChangedCalled);
}
示例2: StudioResourceRepository_DeleteVersion_TwoItemsReturned_ItemsAttachedToParent
public void StudioResourceRepository_DeleteVersion_TwoItemsReturned_ItemsAttachedToParent()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
var v1 = new Mock<IVersionInfo>();
v1.Setup(v => v.VersionNumber).Returns("1");
var v2 = new Mock<IVersionInfo>();
v2.Setup(v => v.VersionNumber).Returns("2");
mockVersionRepository.Setup(m => m.DeleteVersion(It.IsAny<Guid>(), It.IsAny<string>()))
.Returns(new List<IExplorerItem>
{
new ServerExplorerItem { ResourceType = ResourceType.WebService, DisplayName = "v2 2012-10-10 Save", ResourceId = Guid.NewGuid(), Permissions = Permissions.View, VersionInfo = v1.Object },
new ServerExplorerItem { ResourceType = ResourceType.WebService, DisplayName = "v1 2012-10-10 Save", ResourceId = Guid.NewGuid(), Permissions = Permissions.View , VersionInfo = v2.Object }
})
.Verifiable();
var superWFId = Guid.NewGuid();
var parent = new ServerExplorerItem
{
ResourceType = ResourceType.WorkflowService,
DisplayName = "SuperWF",
ResourceId = superWFId,
Permissions = Permissions.Contribute,
ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER"
};
SetupEnvironmentRepo(Guid.Empty);
var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object,
GetCurrentEnvironment = () => Guid.Empty
};
var versionInfo = new VersionInfo
{
DateTimeStamp = DateTime.Now,
Reason = "Rollback",
ResourceId = superWFId,
User = "",
VersionId = Guid.NewGuid(),
VersionNumber = "3"
};
//------------Execute Test---------------------------
repo.DeleteVersion(versionInfo, Guid.Empty);
//------------Assert Results-------------------------
var actual = repo.FindItemById(superWFId);
Assert.AreEqual(2, actual.Children.Count);
mockVersionRepository.Verify(m => m.DeleteVersion(It.IsAny<Guid>(), It.IsAny<string>()), Times.Once());
}
示例3: StudioResourceRepository_HideHistory_ClearsChildren
public void StudioResourceRepository_HideHistory_ClearsChildren()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
var superWFId = Guid.NewGuid();
var parent = new ServerExplorerItem
{
ResourceType = ResourceType.WorkflowService,
DisplayName = "SuperWF",
ResourceId = superWFId,
Permissions = Permissions.Contribute,
ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER",
Children = new List<IExplorerItem>
{
new ServerExplorerItem{ ResourceType = ResourceType.WebService, DisplayName = "v2 2012-10-10 Save", ResourceId = Guid.NewGuid(), Permissions = Permissions.View },
new ServerExplorerItem{ ResourceType = ResourceType.WebService, DisplayName = "v2 2012-10-10 Save", ResourceId = Guid.NewGuid(), Permissions = Permissions.View }
}
};
SetupEnvironmentRepo(Guid.Empty);
var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object,
GetCurrentEnvironment = () => Guid.Empty
};
//------------Execute Test---------------------------
repo.HideVersionHistory(Guid.Empty, superWFId);
//------------Assert Results-------------------------
var actual = repo.FindItemById(superWFId);
Assert.AreEqual(0, actual.Children.Count);
}
示例4: StudioResourceRepository_ShowVersionHistory_NoItemsReturned_InfoItemAttachedToParent
public void StudioResourceRepository_ShowVersionHistory_NoItemsReturned_InfoItemAttachedToParent()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
mockVersionRepository.Setup(m => m.GetVersions(It.IsAny<Guid>())).Returns(new List<IExplorerItem>());
var superWFId = Guid.NewGuid();
var parent = new ServerExplorerItem
{
ResourceType = ResourceType.WorkflowService,
DisplayName = "SuperWF",
ResourceId = superWFId,
Permissions = Permissions.Contribute,
ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER"
};
SetupEnvironmentRepo(Guid.Empty);
var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object,
GetCurrentEnvironment = () => Guid.Empty
};
//------------Execute Test---------------------------
repo.ShowVersionHistory(Guid.Empty, superWFId);
//------------Assert Results-------------------------
var actual = repo.FindItemById(superWFId);
Assert.AreEqual(1, actual.Children.Count);
Assert.AreEqual("There is no version history to display", actual.Children[0].DisplayName);
}
示例5: StudioResourceRepository_FindItemByID_ItemDoesNotExist_ShouldReturnNull
public void StudioResourceRepository_FindItemByID_ItemDoesNotExist_ShouldReturnNull()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var environmentId = Guid.NewGuid();
var workflowId = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var mockVersionRepository = new Mock<IVersionRepository>();
var repository = new StudioResourceRepository(GetTestData(workflowId.ToString()), environmentId, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object
};
//------------Execute Test---------------------------
var findItemById = repository.FindItemById(Guid.NewGuid());
//------------Assert Results-------------------------
Assert.IsNull(findItemById);
}
示例6: StudioResourceRepository_FindItemByID_ItemExists_ShouldReturnItem
public void StudioResourceRepository_FindItemByID_ItemExists_ShouldReturnItem()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
mockExplorerResourceRepository.Setup(m => m.RenameItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>())).Verifiable();
var environmentId = Guid.NewGuid();
var workflowId = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var mockVersionRepository = new Mock<IVersionRepository>();
var repository = new StudioResourceRepository(GetTestData(workflowId.ToString()), environmentId, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object
};
//------------Execute Test---------------------------
var findItemById = repository.FindItemById(workflowId);
//------------Assert Results-------------------------
Assert.IsNotNull(findItemById);
}