public void Parse_InvalidTmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); // Act Tmx result = parser.Parse(MockObjects.INVALID_TmxFilePath); // Assert Assert.IsNull(result); }
public void Parse_InvalidTmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); // Act Tmx result = parser.Parse(MockObjects.INVALID_TmxFilePath); // Assert Assert.IsNull(result); }
public void Parse_EmptyTmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); // Act Tmx result = parser.Parse(MockObjects.EMPTY_TmxFilePath); // Assert Assert.IsNull(result); }
public void Parse_EmptyTmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); // Act Tmx result = parser.Parse(MockObjects.EMPTY_TmxFilePath); // Assert Assert.IsNull(result); }
public void Parse_NonExistTmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); // Act Tmx result = parser.Parse(MockObjects.NonEXIST_TmxFilePath); // Assert Assert.IsNull(result); }
public void Parse_Valid_pseudo_TmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); Tmx expected = MockObjects.VALID_pseudo_TmxObject; // Act Tmx result = parser.Parse(MockObjects.VALID_pseudo_TmxFilePath); // Assert // -- Assert version Assert.AreEqual(expected.Version, result.Version); // -- Assert header Assert.AreEqual(expected.Header.CreationToolVersion, result.Header.CreationToolVersion); Assert.AreEqual(expected.Header.DataType, result.Header.DataType); Assert.AreEqual(expected.Header.SegmentType, result.Header.SegmentType); Assert.AreEqual(expected.Header.AdminLanguage, result.Header.AdminLanguage); Assert.AreEqual(expected.Header.SourceLanguage, result.Header.SourceLanguage); Assert.AreEqual(expected.Header.OriginalTranslationMemoryFormat, result.Header.OriginalTranslationMemoryFormat); Assert.AreEqual(expected.Header.CreationTool, result.Header.CreationTool); // -- Assert body // ---- Assert TranslationUnits foreach (TranslationUnit expectedTU in expected.Body.TranslationUnits) { TranslationUnit unit = result.Body.TranslationUnits .First <TranslationUnit>( tu => tu.TranslationUnitId == expectedTU.TranslationUnitId ); Assert.IsNotNull(unit); Assert.AreEqual(expectedTU.TranslationUnitId, unit.TranslationUnitId); // ---- Assert TranslationUnitVariant foreach (TranslationUnitVariant expectedTUV in expectedTU.TranslationUnitVariants) { TranslationUnitVariant unitVar = unit.TranslationUnitVariants .First <TranslationUnitVariant>( tuv => tuv.Segment == expectedTUV.Segment ); Assert.IsNotNull(unitVar); Assert.AreEqual(expectedTUV.Language, unitVar.Language); Assert.AreEqual(expectedTUV.Segment, unitVar.Segment); } } }
public void Parse_TmxFileNoTranslationUnits_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); Tmx expected = MockObjects.VALID_en_TmxObject; // Act Tmx result = parser.Parse(MockObjects.NO_TRANSLATION_UNITS_TmxFilePath); // Assert // -- Assert version Assert.AreEqual(expected.Version, result.Version); // -- Assert header Assert.AreEqual(expected.Header.CreationToolVersion, result.Header.CreationToolVersion); Assert.AreEqual(expected.Header.DataType, result.Header.DataType); Assert.AreEqual(expected.Header.SegmentType, result.Header.SegmentType); Assert.AreEqual(expected.Header.AdminLanguage, result.Header.AdminLanguage); Assert.AreEqual(expected.Header.SourceLanguage, result.Header.SourceLanguage); Assert.AreEqual(expected.Header.OriginalTranslationMemoryFormat, result.Header.OriginalTranslationMemoryFormat); Assert.AreEqual(expected.Header.CreationTool, result.Header.CreationTool); // -- Assert body // ---- Assert TranslationUnits Assert.AreEqual(0, result.Body.TranslationUnits.Count); }
public void Parse_TmxFileNoTranslationUnitVarients_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); Tmx expected = MockObjects.VALID_en_TmxObject; // Act Tmx result = parser.Parse(MockObjects.NO_TRANSLATION_UNITS_VARIENTS_TmxFilePath); // Assert // -- Assert version Assert.AreEqual(expected.Version, result.Version); // -- Assert header Assert.AreEqual(expected.Header.CreationToolVersion, result.Header.CreationToolVersion); Assert.AreEqual(expected.Header.DataType, result.Header.DataType); Assert.AreEqual(expected.Header.SegmentType, result.Header.SegmentType); Assert.AreEqual(expected.Header.AdminLanguage, result.Header.AdminLanguage); Assert.AreEqual(expected.Header.SourceLanguage, result.Header.SourceLanguage); Assert.AreEqual(expected.Header.OriginalTranslationMemoryFormat, result.Header.OriginalTranslationMemoryFormat); Assert.AreEqual(expected.Header.CreationTool, result.Header.CreationTool); // -- Assert body // ---- Assert TranslationUnits foreach (TranslationUnit expectedTU in expected.Body.TranslationUnits) { TranslationUnit unit = result.Body.TranslationUnits .First <TranslationUnit>( tu => tu.TranslationUnitId == expectedTU.TranslationUnitId ); Assert.IsNotNull(unit); Assert.AreEqual(expectedTU.TranslationUnitId, unit.TranslationUnitId); // ---- Assert TranslationUnitVariant Assert.AreEqual(0, unit.TranslationUnitVariants.Count); } }
public void Parse_NonExistTmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); // Act Tmx result = parser.Parse(MockObjects.NonEXIST_TmxFilePath); // Assert Assert.IsNull(result); }
public void Parse_Valid_pseudo_TmxFile_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); Tmx expected = MockObjects.VALID_pseudo_TmxObject; // Act Tmx result = parser.Parse(MockObjects.VALID_pseudo_TmxFilePath); // Assert // -- Assert version Assert.AreEqual(expected.Version, result.Version); // -- Assert header Assert.AreEqual(expected.Header.CreationToolVersion, result.Header.CreationToolVersion); Assert.AreEqual(expected.Header.DataType, result.Header.DataType); Assert.AreEqual(expected.Header.SegmentType, result.Header.SegmentType); Assert.AreEqual(expected.Header.AdminLanguage, result.Header.AdminLanguage); Assert.AreEqual(expected.Header.SourceLanguage, result.Header.SourceLanguage); Assert.AreEqual(expected.Header.OriginalTranslationMemoryFormat, result.Header.OriginalTranslationMemoryFormat); Assert.AreEqual(expected.Header.CreationTool, result.Header.CreationTool); // -- Assert body // ---- Assert TranslationUnits foreach (TranslationUnit expectedTU in expected.Body.TranslationUnits) { TranslationUnit unit = result.Body.TranslationUnits .First<TranslationUnit>( tu => tu.TranslationUnitId == expectedTU.TranslationUnitId ); Assert.IsNotNull(unit); Assert.AreEqual(expectedTU.TranslationUnitId, unit.TranslationUnitId); // ---- Assert TranslationUnitVariant foreach (TranslationUnitVariant expectedTUV in expectedTU.TranslationUnitVariants) { TranslationUnitVariant unitVar = unit.TranslationUnitVariants .First<TranslationUnitVariant>( tuv => tuv.Segment == expectedTUV.Segment ); Assert.IsNotNull(unitVar); Assert.AreEqual(expectedTUV.Language, unitVar.Language); Assert.AreEqual(expectedTUV.Segment, unitVar.Segment); } } }
public void Parse_TmxFileNoTranslationUnitVarients_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); Tmx expected = MockObjects.VALID_en_TmxObject; // Act Tmx result = parser.Parse(MockObjects.NO_TRANSLATION_UNITS_VARIENTS_TmxFilePath); // Assert // -- Assert version Assert.AreEqual(expected.Version, result.Version); // -- Assert header Assert.AreEqual(expected.Header.CreationToolVersion, result.Header.CreationToolVersion); Assert.AreEqual(expected.Header.DataType, result.Header.DataType); Assert.AreEqual(expected.Header.SegmentType, result.Header.SegmentType); Assert.AreEqual(expected.Header.AdminLanguage, result.Header.AdminLanguage); Assert.AreEqual(expected.Header.SourceLanguage, result.Header.SourceLanguage); Assert.AreEqual(expected.Header.OriginalTranslationMemoryFormat, result.Header.OriginalTranslationMemoryFormat); Assert.AreEqual(expected.Header.CreationTool, result.Header.CreationTool); // -- Assert body // ---- Assert TranslationUnits foreach (TranslationUnit expectedTU in expected.Body.TranslationUnits) { TranslationUnit unit = result.Body.TranslationUnits .First<TranslationUnit>( tu => tu.TranslationUnitId == expectedTU.TranslationUnitId ); Assert.IsNotNull(unit); Assert.AreEqual(expectedTU.TranslationUnitId, unit.TranslationUnitId); // ---- Assert TranslationUnitVariant Assert.AreEqual(0, unit.TranslationUnitVariants.Count); } }
public void Parse_TmxFileNoTranslationUnits_To_TmxObject_Test() { // Assign TmxParser_Accessor parser = new TmxParser_Accessor(); Tmx expected = MockObjects.VALID_en_TmxObject; // Act Tmx result = parser.Parse(MockObjects.NO_TRANSLATION_UNITS_TmxFilePath); // Assert // -- Assert version Assert.AreEqual(expected.Version, result.Version); // -- Assert header Assert.AreEqual(expected.Header.CreationToolVersion, result.Header.CreationToolVersion); Assert.AreEqual(expected.Header.DataType, result.Header.DataType); Assert.AreEqual(expected.Header.SegmentType, result.Header.SegmentType); Assert.AreEqual(expected.Header.AdminLanguage, result.Header.AdminLanguage); Assert.AreEqual(expected.Header.SourceLanguage, result.Header.SourceLanguage); Assert.AreEqual(expected.Header.OriginalTranslationMemoryFormat, result.Header.OriginalTranslationMemoryFormat); Assert.AreEqual(expected.Header.CreationTool, result.Header.CreationTool); // -- Assert body // ---- Assert TranslationUnits Assert.AreEqual(0, result.Body.TranslationUnits.Count); }