public void GetVersions_Execute_ExpectSuccess_NonDbType() { //------------Setup for test-------------------------- var getVersions = new GetVersion(); var resourceId = Guid.NewGuid(); var versionId = Guid.NewGuid(); //var wsId = Guid.NewGuid(); var ws = new Mock <IWorkspace>(); var version = new VersionInfo(DateTime.Now, "bob", "dave", "2", resourceId, versionId); var mockRes = new Mock <IResource>(); var servVer = new Mock <IServerVersionRepository>(); servVer.Setup(a => a.GetVersion(It.IsAny <VersionInfo>(), It.IsAny <string>())).Returns(new StringBuilder(resourceOne)); mockRes.Setup(a => a.ResourceType).Returns("WorkflowService"); var cat = new Mock <IResourceCatalog>(); cat.Setup(a => a.GetResource(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(mockRes.Object); var serializer = new Dev2JsonSerializer(); ws.Setup(a => a.ID).Returns(Guid.Empty); getVersions.ServerVersionRepo = servVer.Object; getVersions.ResourceCatalog = cat.Object; var serialisr = new Dev2JsonSerializer(); //------------Execute Test--------------------------- var ax = getVersions.Execute(new Dictionary <string, StringBuilder> { { "versionInfo", serialisr.SerializeToBuilder(version) } }, ws.Object); //------------Assert Results------------------------- var ver = serializer.Deserialize <ExecuteMessage>(ax.ToString()); Assert.AreEqual(ExpectedModifiedVersion, ver.Message.ToString()); }
public void GetVersions_Execute_ExpectException_NoArgs() { //------------Setup for test-------------------------- var getVersions = new GetVersion(); var serialiser = new Dev2JsonSerializer(); //------------Execute Test--------------------------- var ax = getVersions.Execute(new Dictionary <string, StringBuilder>(), new Workspace(Guid.NewGuid())); Assert.AreEqual(ExecStatus.Fail, serialiser.Deserialize <ExplorerRepositoryResult>(ax).Status); }