public void ChangeTrackingDefaultValue_RevisionsContainer()
        {
            RevisionsContainer container;

            container = new RevisionsContainer();
            Assert.IsNull(container.AppliesTo, "AppliesTo is incorrect.");
            Assert.IsNull(container.CurrentVersion, "CurrentVersion is incorrect.");
            Assert.IsNull(container.Reference, "Reference is incorrect.");
            Assert.AreEqual(0, container.Revisions.Count, "Revisions count is incorrect.");
        }
        public void StandardValidator_ChangeTrack_ChangeTrack()
        {
            ChangeTrack change;
            Item item;
            Revision revision;
            RevisionsContainer container;

            change = new ChangeTrack();

            Console.WriteLine("Test that ChangeTrack has at least on RevisionsContainer.");
            this.DeserializeDocument();
            this._document.Files[0].Changes = change;
            this.VerifyValidationException(ValidationError.ChangeTrackMissingRevisions);

            Console.WriteLine("Test with a valid change track.");
            item = new Item();
            item.Property = "property";
            revision = new Revision();
            revision.Items.Add(item);
            container = new RevisionsContainer();
            container.AppliesTo = "appliesTo";
            container.Revisions.Add(revision);
            change.Revisions.Add(container);
            StandardValidatorTests._validator.Validate(this._document);
        }
        public void StandardValidator_ChangeTrack_RevisionsContainer()
        {
            ChangeTrack change;
            Item item;
            Revision revision;
            RevisionsContainer container;

            item = new Item();
            item.Property = "property";
            revision = new Revision();
            revision.Items.Add(item);
            container = new RevisionsContainer();
            change = new ChangeTrack();
            change.Revisions.Add(container);

            this.DeserializeDocument();
            this._document.Files[0].Changes = change;

            Console.WriteLine("Test with no revisions.");
            container.AppliesTo = "appliesTo";
            container.Reference = "reference";
            container.CurrentVersion = "version";
            this.VerifyValidationException(ValidationError.RevisionsContainerMissingRevisions);
            container.Revisions.Add(revision);

            Console.WriteLine("Test with invalid appliesTo.");
            container.AppliesTo = "!!@";
            this.VerifyValidationException(ValidationError.RevisionsContainerAppliesToNotNMToken);
            container.AppliesTo = "appliesTo";

            Console.WriteLine("Test with invalid reference.");
            container.Reference = "!!@";
            this.VerifyValidationException(ValidationError.RevisionsContainerReferenceNotNMToken);
            container.Reference = "reference";

            Console.WriteLine("Test with invalid currentVersion.");
            container.CurrentVersion = "!!@";
            this.VerifyValidationException(ValidationError.RevisionsContainerCurrentVersionNotNMToken);
            container.CurrentVersion = "version";

            Console.WriteLine("Test with valid data.");
            StandardValidatorTests._validator.Validate(this._document);
        }
        public void StandardValidator_ChangeTrack_Item()
        {
            ChangeTrack change;
            Item item;
            Revision revision;
            RevisionsContainer container;

            item = new Item();
            revision = new Revision();
            revision.Items.Add(item);
            container = new RevisionsContainer();
            container.AppliesTo = "appliesTo";
            container.Revisions.Add(revision);
            change = new ChangeTrack();
            change.Revisions.Add(container);

            this.DeserializeDocument();
            this._document.Files[0].Changes = change;

            Console.WriteLine("Test with null property.");
            item.Property = null;
            this.VerifyValidationException(ValidationError.ItemPropertyNull);

            Console.WriteLine("Test with empty property.");
            item.Property = null;
            this.VerifyValidationException(ValidationError.ItemPropertyNull);

            Console.WriteLine("Test with whitespace only property.");
            item.Property = "   ";
            this.VerifyValidationException(ValidationError.ItemPropertyNull);

            Console.WriteLine("Test with non-empty property.");
            item.Property = "property";
            StandardValidatorTests._validator.Validate(this._document);
        }
예제 #5
0
        public void XliffWriter_ChangeTrack()
        {
            ChangeTrack change;
            Item item;
            RevisionsContainer container;
            Revision revision;
            string actualValue;

            change = new ChangeTrack();

            container = new RevisionsContainer();
            container.AppliesTo = "source";
            container.Reference = "1";
            container.CurrentVersion = "ver1";
            change.Revisions.Add(container);

            revision = new Revision();
            revision.Author = "author";
            revision.ChangeDate = new DateTime(2015, 1, 2, 3, 4, 5);
            revision.Version = "ver1";
            container.Revisions.Add(revision);

            item = new Item();
            item.Property = "content";
            item.Text = "text";
            revision.Items.Add(item);

            this._document.Files.Add(new File("f1"));
            this._document.Files[0].Changes = change;

            actualValue = this.Serialize();
            Assert.AreEqual(TestUtilities.GetFileContents(TestData.FileWithChangeTrack), actualValue);
        }
예제 #6
0
        /// <summary>
        /// Creates a <see cref="RevisionsContainer"/> with every element and attribute.
        /// </summary>
        /// <returns>The created <see cref="RevisionsContainer"/>.</returns>
        private RevisionsContainer CreateChangeTrackingModule_RevisionsContainer()
        {
            RevisionsContainer result;

            result = new RevisionsContainer();
            result.AppliesTo = "source";
            result.Reference = "1";
            result.CurrentVersion = "ver1";

            result.Revisions.Add(this.CreateChangeTrackModule_Revision());
            this.AddExtension(result);

            return result;
        }
 public void TestInitialize()
 {
     this.element = new RevisionsContainer();
     this.provider = this.element;
 }