本文整理汇总了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() });
}
示例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() });
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}