Execute() public method

Executes the service
public Execute ( StringBuilder>.Dictionary values, IWorkspace theWorkspace ) : StringBuilder
values StringBuilder>.Dictionary The values.
theWorkspace IWorkspace The workspace.
return StringBuilder
Beispiel #1
0
 public void GetVersions_Execute_ExpectException_NoArgs()
 {
     //------------Setup for test--------------------------
     var getVersions = new GetVersion();
     Dev2JsonSerializer 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);
 }
Beispiel #2
0
        public void GetVersions_Execute_ExpectSuccess_DbType()
        {
            //------------Setup for test--------------------------
            var getVersions = new GetVersion();
            var resourceId = Guid.NewGuid();
            var versionId = Guid.NewGuid();
            //var wsId = Guid.NewGuid();
            var ws = new Mock<IWorkspace>();
            VersionInfo 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>())).Returns(new StringBuilder(resourceOne));
            mockRes.Setup(a => a.ResourceType).Returns(ResourceType.DbSource);

            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.Resources = cat.Object;
            Dev2JsonSerializer 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(ver.Message.ToString(),resourceOne);

        }