Ejemplo n.º 1
0
        public void Test_GetCommands()
        {
            RenamePropertyCommand command1 = new RenamePropertyCommand();

            command1.TypeName        = "TestUser";
            command1.PropertyName    = "LastName";
            command1.NewPropertyName = "Surname";

            RenameTypeCommand command2 = new RenameTypeCommand();

            command2.TypeName    = "TestUser";
            command2.NewTypeName = "TestAccount";

            DataSchemaCommandCollection commands = new DataSchemaCommandCollection();

            commands.Add(command1);
            commands.Add(command2);

            Version legacyVersion  = new Version(1, 0, 0, 0);
            Version commandVersion = new Version(1, 1, 0, 0);
            Version currentVersion = new Version(1, 1, 0, 0);

            string groupName = "TestGroup";

            string commandsPath = TestUtilities.GetTestingPath(this) + Path.DirectorySeparatorChar + DataAccess.Data.Schema.SchemaDirectory;

            DataSchema schema = (DataSchema)DataAccess.Data.InitializeDataSchema();

            schema.SchemaCommandDirectoryPath = commandsPath;
            schema.LegacyVersion      = legacyVersion;
            schema.ApplicationVersion = currentVersion;

            schema.SaveCommands(commandsPath, commands, groupName, commandVersion);

            DataSchemaCommandCollection foundCommands = schema.GetCommands();

            Assert.AreEqual(commands.Count, foundCommands.Count, "Incorrect number of commands found.");
        }