Ejemplo n.º 1
0
        public void ToXlf12Test()
        {
            Assert.ThrowsException <ArgumentNullException>(() => StateConverter.ToXlfV12(null));
            StateConverter.ToXlfV12(string.Empty).Should().Be(Xlf12States.New);
            StateConverter.ToXlfV12(" ").Should().Be(Xlf12States.New);

            // XLIFF 1.2 states
            foreach (var state in Xlf12States.Enumerate())
            {
                StateConverter.ToXlfV12(state).Should().Be(state);
            }

            // XLIFF 1.2 user states
            foreach (var state in new string[] { StateConverter.XlfV12UserStatePrefix, StateConverter.XlfV12UserStatePrefix + "asasdsadj kljkl" })
            {
                StateConverter.ToXlfV12(state).Should().Be(state, "All user specific states are passed through 1:1.");
            }

            // MuiDB states
            StateConverter.ToXlfV12(MuiDbStates.New).Should().Be(Xlf12States.New);
            StateConverter.ToXlfV12(MuiDbStates.Translated).Should().Be(Xlf12States.Translated);
            StateConverter.ToXlfV12(MuiDbStates.Reviewed).Should().Be(Xlf12States.SignedOff);
            StateConverter.ToXlfV12(MuiDbStates.Final).Should().Be(Xlf12States.Final);

            // XLIFF v2.0 states
            StateConverter.ToXlfV12(Xlf20States.Initial).Should().Be(Xlf12States.New);
            StateConverter.ToXlfV12(Xlf20States.Translated).Should().Be(Xlf12States.Translated);
            StateConverter.ToXlfV12(Xlf20States.Reviewed).Should().Be(Xlf12States.SignedOff);
            StateConverter.ToXlfV12(Xlf20States.Final).Should().Be(Xlf12States.Final);
        }
Ejemplo n.º 2
0
        public void EnumerateKnownStatesTest()
        {
            foreach (var state in MuiDbStates.Enumerate())
            {
                switch (state)
                {
                case MuiDbStates.New:
                case MuiDbStates.Translated:
                case MuiDbStates.Reviewed:
                case MuiDbStates.Final:
                    break;

                default:
                    Assert.Fail($"state {state} is unknown! Please adjust other tests as well!");
                    break;
                }
            }

            foreach (var state in Xlf12States.Enumerate())
            {
                switch (state)
                {
                case Xlf12States.Final:
                case Xlf12States.NeedsAdaptation:
                case Xlf12States.NeedsL10n:
                case Xlf12States.NeedsReviewAdaptation:
                case Xlf12States.NeedsReviewL10n:
                case Xlf12States.NeedsReviewTranslation:
                case Xlf12States.NeedsTranslation:
                case Xlf12States.New:
                case Xlf12States.SignedOff:
                case Xlf12States.Translated:
                    break;

                default:
                    Assert.Fail($"state {state} is unknown! Please adjust other tests as well!");
                    break;
                }
            }

            foreach (var state in Xlf20States.Enumerate())
            {
                switch (state)
                {
                case Xlf20States.Initial:
                case Xlf20States.Translated:
                case Xlf20States.Reviewed:
                case Xlf20States.Final:
                    break;

                default:
                    Assert.Fail($"state {state} is unknown! Please adjust other tests as well!");
                    break;
                }
            }
        }