本文整理汇总了C#中Dev2.AppResources.Repositories.StudioResourceRepository类的典型用法代码示例。如果您正苦于以下问题:C# StudioResourceRepository类的具体用法?C# StudioResourceRepository怎么用?C# StudioResourceRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StudioResourceRepository类属于Dev2.AppResources.Repositories命名空间,在下文中一共展示了StudioResourceRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateModels
protected StudioResourceRepository CreateModels(bool isChecked, Mock<IContextualResourceModel> mockResourceModel, out IEnvironmentModel environmentModel, out IExplorerItemModel resourceVm, out IExplorerItemModel rootItem)
{
Mock<IContextualResourceModel> resourceModel = mockResourceModel;
var connection = new Mock<IEnvironmentConnection>();
var mockEnvironmentModel = new Mock<IEnvironmentModel>();
mockEnvironmentModel.Setup(e => e.Connection).Returns(connection.Object);
mockEnvironmentModel.Setup(a => a.AuthorizationService).Returns(new Mock<IAuthorizationService>().Object);
environmentModel = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List<IResourceModel>()).Object;
var serverItemModel = new ExplorerItemModel { DisplayName = "localhost", ResourceType = ResourceType.Server, EnvironmentId = environmentModel.ID, ResourcePath = "", ResourceId = Guid.NewGuid() };
rootItem = serverItemModel;
ExplorerItemModel workflowsFolder = new ExplorerItemModel { DisplayName = "WORKFLOWS", ResourceType = ResourceType.Folder, ResourcePath = "WORKFLOWS", EnvironmentId = mockEnvironmentModel.Object.ID, ResourceId = Guid.NewGuid() };
serverItemModel.Children.Add(workflowsFolder);
var studioResourceRepository = new StudioResourceRepository(serverItemModel, _Invoke);
resourceModel.Setup(model => model.Category).Returns("WORKFLOWS\\" + resourceModel.Object.DisplayName);
TestEnvironmentRespository testEnvironmentRespository = new TestEnvironmentRespository(environmentModel);
// ReSharper disable ObjectCreationAsStatement
new EnvironmentRepository(testEnvironmentRespository);
// ReSharper restore ObjectCreationAsStatement
IEnvironmentModel internalEnvironmentModel = environmentModel;
studioResourceRepository.GetCurrentEnvironment = () => internalEnvironmentModel.ID;
studioResourceRepository.AddResouceItem(resourceModel.Object);
resourceVm = workflowsFolder.Children[0];
resourceVm.IsChecked = isChecked;
return studioResourceRepository;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:29,代码来源:DeployStatsCalculatorTests.cs
示例2: 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:Robin--,项目名称:Warewolf,代码行数:32,代码来源:StudioResourceRepositoryTests.cs
示例3: StudioResourceRepository_RemoveEnvironment_ServerHasChildren_ServerIsRemovedFromTree
public void StudioResourceRepository_RemoveEnvironment_ServerHasChildren_ServerIsRemovedFromTree()
{
//------------Setup for test--------------------------
var environmentId = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var repository = new StudioResourceRepository(GetTestData(), environmentId, _invoke);
//------------Execute Test---------------------------
var countBeforeDisconnect = repository.ExplorerItemModels.Count;
repository.RemoveEnvironment(environmentId);
var countAfterDisconnect = repository.ExplorerItemModels.Count;
//------------Assert Results-------------------------
Assert.AreEqual(1, countBeforeDisconnect);
Assert.AreEqual(0, countAfterDisconnect);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:14,代码来源:StudioResourceRepositoryTests.cs
示例4: StudioResourceRepository_Disconnect_ServerHasChildren_ServerIsDisconnectedAndChildrenAreCollapsed
public void StudioResourceRepository_Disconnect_ServerHasChildren_ServerIsDisconnectedAndChildrenAreCollapsed()
{
//------------Setup for test--------------------------
var environmentId = Guid.NewGuid();
SetupEnvironmentRepo(environmentId);
var repository = new StudioResourceRepository(GetTestData(), environmentId, _invoke);
//------------Execute Test---------------------------
var countBeforeDisconnect = repository.ExplorerItemModels[0].Children.Count;
var isConnectedBeforeDisconnect = repository.ExplorerItemModels[0].IsConnected;
repository.Disconnect(environmentId);
var countAfterDisconnect = repository.ExplorerItemModels[0].Children.Count;
var isConnectedAfterDisconnect = repository.ExplorerItemModels[0].IsConnected;
//------------Assert Results-------------------------
Assert.AreEqual(2, countBeforeDisconnect);
Assert.AreEqual(0, countAfterDisconnect);
Assert.AreEqual(true, isConnectedBeforeDisconnect);
Assert.AreEqual(false, isConnectedAfterDisconnect);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:19,代码来源:StudioResourceRepositoryTests.cs
示例5: StudioResourceRepository_Load_CallsServiceLoad
public void StudioResourceRepository_Load_CallsServiceLoad()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
// ReSharper disable MaximumChainedReferences
mockExplorerResourceRepository.Setup(m => m.Load(It.IsAny<Guid>()))
.Returns(new ServerExplorerItem { DisplayName = "some name" })
.Verifiable();
var mockVersionRepository = new Mock<IVersionRepository>();
SetupEnvironmentRepo(Guid.Empty);
var repository = new StudioResourceRepository(null, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object
};
var mockResourceRepository = new Mock<IResourceRepository>();
Mock<IEnvironmentModel> mockEnvironment = EnviromentRepositoryTest.CreateMockEnvironment(mockResourceRepository.Object, "localhost");
mockEnvironment.Setup(model => model.ID).Returns(Guid.Empty);
GetEnvironmentRepository(mockEnvironment);
//------------Execute Test---------------------------
repository.Load(Guid.Empty, AsyncWorkerTests.CreateSynchronousAsyncWorker().Object);
//------------Assert Results-------------------------
mockExplorerResourceRepository.Verify(m => m.Load(It.IsAny<Guid>()), Times.Never());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:31,代码来源:StudioResourceRepositoryTests.cs
示例6: StudioResourceRepository_DeleteFolder_DeleteServiceThrowsAndException_ReThrowsAnException
public void StudioResourceRepository_DeleteFolder_DeleteServiceThrowsAndException_ReThrowsAnException()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
mockExplorerResourceRepository.Setup(m => m.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
.Throws(new Exception("Something really bad happened, reboot your PC or risk a Harddrive crash"));
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 explorerItemModel = repository.ExplorerItemModels[0].Children[0];
repository.DeleteFolder(explorerItemModel);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:19,代码来源:StudioResourceRepositoryTests.cs
示例7: StudioResourceRepository_DeleteFolder_DeleteServiceReturnsAnError_ThrowsAnException
public void StudioResourceRepository_DeleteFolder_DeleteServiceReturnsAnError_ThrowsAnException()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
mockExplorerResourceRepository.Setup(m => m.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
.Returns(new ExplorerRepositoryResult(ExecStatus.Fail, "Just Failed"));
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
};
//------------Execute Test---------------------------
var explorerItemModel = repository.ExplorerItemModels[0].Children[0];
repository.DeleteFolder(explorerItemModel);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:21,代码来源:StudioResourceRepositoryTests.cs
示例8: StudioResourceRepository_DeleteFolder_ItemIsNotOnExplorerItemModels_DoesNotCallsDeleteOnService
public void StudioResourceRepository_DeleteFolder_ItemIsNotOnExplorerItemModels_DoesNotCallsDeleteOnService()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
mockExplorerResourceRepository.Setup(m => m.DeleteItem(It.IsAny<IExplorerItem>(), 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---------------------------
repository.DeleteFolder(new ExplorerItemModel());
//------------Assert Results-------------------------
mockExplorerResourceRepository.Verify(m => m.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()), Times.Never());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:20,代码来源:StudioResourceRepositoryTests.cs
示例9: StudioResourceRepository_GetVersion_VersionIsNull_ThrowsException
public void StudioResourceRepository_GetVersion_VersionIsNull_ThrowsException()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
var parent = new ServerExplorerItem
{
ResourceType = ResourceType.WorkflowService,
DisplayName = "SuperWF",
ResourceId = Guid.NewGuid(),
Permissions = Permissions.Contribute,
ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER"
};
var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object,
GetCurrentEnvironment = () => Guid.Empty
};
//------------Execute Test---------------------------
repo.GetVersion(null, Guid.Empty);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:23,代码来源:StudioResourceRepositoryTests.cs
示例10: 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());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:53,代码来源:StudioResourceRepositoryTests.cs
示例11: StudioResourceRepository_GetServerVersion_CallsProxy_ReturnsDefault_IfError
public void StudioResourceRepository_GetServerVersion_CallsProxy_ReturnsDefault_IfError()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
var parent = new ServerExplorerItem
{
ResourceType = ResourceType.WorkflowService,
DisplayName = "SuperWF",
ResourceId = Guid.NewGuid(),
Permissions = Permissions.Contribute,
ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER"
};
var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object,
GetCurrentEnvironment = () => Guid.Empty,
GetEnvironmentRepository = () => new Mock<IEnvironmentRepository>().Object
};
var env = Guid.NewGuid();
mockExplorerResourceRepository.Setup(a => a.GetServerVersion()).Throws(new Exception());
//------------Execute Test---------------------------
Assert.AreEqual("Less than 0.4.19.1", repo.GetServerVersion(env));
mockExplorerResourceRepository.Verify(a=>a.GetServerVersion());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:27,代码来源:StudioResourceRepositoryTests.cs
示例12: 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);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:35,代码来源:StudioResourceRepositoryTests.cs
示例13: 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);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:32,代码来源:StudioResourceRepositoryTests.cs
示例14: StudioResourceRepository_Filter_NullString_ReturnsSourceItems
public void StudioResourceRepository_Filter_NullString_ReturnsSourceItems()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var explorerItem = GetTestData();
SetupEnvironmentRepo(Guid.Empty);
var mockVersionRepository = new Mock<IVersionRepository>();
var repository = new StudioResourceRepository(explorerItem, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object
};
//------------Execute Test---------------------------
var explorerItemModels = repository.Filter(null);
//------------Assert Results-------------------------
Assert.IsNotNull(explorerItemModels);
Assert.AreEqual(explorerItemModels[0].DisplayName, repository.ExplorerItemModels[0].DisplayName);
Assert.AreEqual(explorerItemModels[0].Children.Count, repository.ExplorerItemModels[0].Children.Count);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:19,代码来源:StudioResourceRepositoryTests.cs
示例15: StudioResourceRepository_ShowVersionHistory_CallsGetVersionFromProxy
public void StudioResourceRepository_ShowVersionHistory_CallsGetVersionFromProxy()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
mockVersionRepository.Setup(m => m.GetVersions(It.IsAny<Guid>())).Verifiable();
SetupEnvironmentRepo(Guid.Empty);
var repo = new StudioResourceRepository(null, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object,
GetCurrentEnvironment = () => Guid.Empty
};
//------------Execute Test---------------------------
repo.ShowVersionHistory(Guid.NewGuid(), Guid.NewGuid());
//------------Assert Results-------------------------
mockVersionRepository.Verify(m => m.GetVersions(It.IsAny<Guid>()), Times.Once());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:18,代码来源:StudioResourceRepositoryTests.cs
示例16: StudioResourceRepository_Constructor_ExplorerItemIsNull_ExplorerItemCollectionHasZeroItems
public void StudioResourceRepository_Constructor_ExplorerItemIsNull_ExplorerItemCollectionHasZeroItems()
{
AppSettings.LocalHost = "http://localhost:3145";
var repo = new StudioResourceRepository(null, Guid.Empty, _invoke);
Assert.AreEqual(0, repo.ExplorerItemModels.Count);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:6,代码来源:StudioResourceRepositoryTests.cs
示例17: StudioResourceRepository_DeleteFolder_EnvironmentIdDoesnotExists_ThrowsException
public void StudioResourceRepository_DeleteFolder_EnvironmentIdDoesnotExists_ThrowsException()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
mockExplorerResourceRepository.Setup(m => m.DeleteItem(It.IsAny<IExplorerItem>(), 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---------------------------
repository.DeleteItem(Guid.NewGuid(), workflowId);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:18,代码来源:StudioResourceRepositoryTests.cs
示例18: StudioResourceRepository_GetVersion_CallsVersionOnTheProxy
public void StudioResourceRepository_GetVersion_CallsVersionOnTheProxy()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var mockVersionRepository = new Mock<IVersionRepository>();
mockVersionRepository.Setup(m => m.GetVersion(It.IsAny<IVersionInfo>())).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.GetVersion(versionInfo, superWFId);
//------------Assert Results-------------------------
mockVersionRepository.Verify(m => m.GetVersion(It.IsAny<IVersionInfo>()), Times.Once());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:40,代码来源:StudioResourceRepositoryTests.cs
示例19: StudioResourceRepository_DeleteFolder_ItemIsOnExplorerItemModels_CallsDeleteOnService
public void StudioResourceRepository_DeleteFolder_ItemIsOnExplorerItemModels_CallsDeleteOnService()
{
//------------Setup for test--------------------------
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();
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 explorerItemModel = repository.ExplorerItemModels[0].Children[0];
repository.DeleteFolder(explorerItemModel);
//------------Assert Results-------------------------
mockExplorerResourceRepository.Verify(m => m.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()), Times.Once());
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:23,代码来源:StudioResourceRepositoryTests.cs
示例20: StudioResourceRepository_FilterDialog_NullAfterFilter_ReturnsOriginalCollection
public void StudioResourceRepository_FilterDialog_NullAfterFilter_ReturnsOriginalCollection()
{
//------------Setup for test--------------------------
var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
var explorerItem = GetTestData();
SetupEnvironmentRepo(Guid.Empty);
var mockVersionRepository = new Mock<IVersionRepository>();
var repository = new StudioResourceRepository(explorerItem, Guid.Empty, _invoke)
{
GetVersionProxy = id => mockVersionRepository.Object,
GetExplorerProxy = id => mockExplorerResourceRepository.Object
};
//------------Preconditions--------------------------
Assert.AreEqual(4, repository.ExplorerItemModels[0].ChildrenCount);
var explorerItemModels = repository.Filter(model => model.DisplayName.Contains("r1"));
Assert.AreEqual(0, explorerItemModels[0].ChildrenCount);
Assert.AreEqual(1, explorerItemModels[0].Children.Count);
//------------Execute Test---------------------------
repository.Filter(null);
//------------Assert Results-------------------------
Assert.AreEqual(4, repository.ExplorerItemModels[0].ChildrenCount);
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:22,代码来源:StudioResourceRepositoryTests.cs
注:本文中的Dev2.AppResources.Repositories.StudioResourceRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论