コード例 #1
0
        public static MigratorOptions CreateRollbackTo(RollbackTo cmd)
        {
            var result = new MigratorOptions("rollback:toversion")
                         .Init(cmd.Parent);

            result.TargetVersion   = cmd.Version;
            result.TransactionMode = cmd.Parent.TransactionMode;
            return(result);
        }
コード例 #2
0
        public void RolbackTo_Name_GetName()

        {
            //------------Setup for test--------------------------
            var rolbackTo = new RollbackTo();

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual("RollbackTo", rolbackTo.HandlesType());
        }
コード例 #3
0
        public void GetAuthorizationContextForService_ShouldReturnContext()
        {
            //------------Setup for test--------------------------
            var rollbackTo = new RollbackTo();

            //------------Execute Test---------------------------
            var resId = rollbackTo.GetAuthorizationContextForService();

            //------------Assert Results-------------------------
            Assert.AreEqual(AuthorizationContext.Any, resId);
        }
コード例 #4
0
        public void GetResourceID_ShouldReturnEmptyGuid()
        {
            //------------Setup for test--------------------------
            var rollbackTo = new RollbackTo();

            //------------Execute Test---------------------------
            var resId = rollbackTo.GetResourceID(new Dictionary <string, StringBuilder>());

            //------------Assert Results-------------------------
            Assert.AreEqual(Guid.Empty, resId);
        }
コード例 #5
0
        public void RolbackTo_CreateServiceEntry_ExpectCorrectDL()
        {
            //------------Setup for test--------------------------
            var rolbackTo = new RollbackTo();

            //------------Execute Test---------------------------
            var res = rolbackTo.CreateServiceEntry();

            //------------Assert Results-------------------------
            Assert.AreEqual("<DataList><Roles ColumnIODirection=\"Input\"/><ResourceXml ColumnIODirection=\"Input\"/><WorkspaceID ColumnIODirection=\"Input\"/><Dev2System.ManagmentServicePayload ColumnIODirection=\"Both\"></Dev2System.ManagmentServicePayload></DataList>", res.DataListSpecification.ToString());
            Assert.AreEqual(enActionType.InvokeManagementDynamicService, res.Actions.First().ActionType);
            Assert.AreEqual(res.Actions.First().SourceMethod, rolbackTo.HandlesType());
        }
コード例 #6
0
        public void RolbackTo_Execute_InvalidParams()
        {
            //------------Setup for test--------------------------
            var rolbackTo  = new RollbackTo();
            var serializer = new Dev2JsonSerializer();
            var ws         = new Mock <IWorkspace>();
            //------------Execute Test---------------------------
            var ax = rolbackTo.Execute(new Dictionary <string, StringBuilder>(), ws.Object);

            //------------Assert Results-------------------------
            var des = serializer.Deserialize <ExecuteMessage>(ax);

            Assert.AreEqual(des.HasError, true);
        }
コード例 #7
0
        public void RolbackTo_Execute_Valid_ExpectServerCalled()
        {
            //------------Setup for test--------------------------
            var rolbackTo  = new RollbackTo();
            var serializer = new Dev2JsonSerializer();
            var ws         = new Mock <IWorkspace>();
            var server     = new Mock <IServerVersionRepository>();
            var res        = Guid.NewGuid();

            //------------Execute Test---------------------------
            rolbackTo.ServerVersionRepo = server.Object;
            var ax = rolbackTo.Execute(new Dictionary <string, StringBuilder> {
                { "resourceId", new StringBuilder(res.ToString()) }, { "versionNumber", new StringBuilder("1") }
            }, ws.Object);

            //------------Assert Results-------------------------
            serializer.Deserialize <ExecuteMessage>(ax);
            server.Verify(a => a.RollbackTo(res, "1"));
        }