/// <summary> /// Opens translation data from translation studio project file. /// </summary> /// <param name="path">Path of the file.</param> /// <param name="fileName">Name of the file.</param> /// <returns>Object that implements Translation Data Interface.</returns> public ITranslationData OpenTSPFile(string path, string fileName) { string output = File.ReadAllText(path); var projectData = OpenProject(output); var data = _translationDataFactory.CreateTranslationDataFromProject(projectData); return(data); }
public void TranslationDataFactory_CreateTranslationDataFromProject_Test() { // Arrange var data = new ProjectData() { ProjectName = mockProjectName, ProjectLines = mockProjectLines }; var expected = new TranslationData(data, mockSubTranslationDataFactory.Object); // Act var actual = translationDataFactory.CreateTranslationDataFromProject(data); // Assert Assert.IsType <TranslationData>(actual); Assert.IsAssignableFrom <ITranslationData>(actual); Assert.NotStrictEqual(expected, actual); }
public void TranslationDataFactory_GivenNoRawInProjectRaiseException() { // Arrange IProjectData data = new ProjectData() { ProjectLines = new List <IProjectLine>() }; var expectedMessage = "No Raw Lines were submitted into the project."; var expected = new EmptyRawException(expectedMessage); // Act var actual = Record.Exception(() => translationDataFactory.CreateTranslationDataFromProject(data)); var actualMessage = actual.Message; // Assert Assert.IsType <EmptyRawException>(actual); Assert.NotStrictEqual(expected, actual); Assert.Equal(expectedMessage, actualMessage); }