public void InvalidSpaces_Check() { // Arrange, var inputPath = Path.Combine(TestContext.DeploymentDirectory, "InvalidSpaces.mis"); // Act, var target = MisFileSerializer.ReadMisFile(inputPath); // Assert, }
public void MisFile_Read_Write_Works_WrongBrackets() { // Arrange, var inputPath = Path.Combine(TestContext.DeploymentDirectory, "TU01A.mis"); var outputPath = Path.Combine(TestContext.DeploymentDirectory, "directOutput.mis"); var expected = MisFileSerializer.ReadMisFile(inputPath); // Act, MisFileSerializer.WriteMisFile(outputPath, expected); var actual = MisFileSerializer.ReadMisFile(outputPath); // Assert, Assert.AreEqual(expected, actual); File.Delete(outputPath); }
public void RecordWriter_Works() { // Arrange, var path = Path.Combine(TestContext.DeploymentDirectory, "5G1A.mis"); var outputPath = Path.Combine(TestContext.DeploymentDirectory, "original.mis"); var input = MisFileSerializer.GetMultipleRecords(path); var target = new RecordWriter(input); // Act, var lines = target.GetTextLines(); File.WriteAllLines(outputPath, lines); // Assert, }
public void MisFile_Read_Write_Works() { // Arrange, //var path = @"D:\Code\CommandosMissionEditor\TestResults\Deploy_fhnas 2019-01-01 16_49_28\Out\firstOutput.mis"; var inputPath = Path.Combine(TestContext.DeploymentDirectory, "5G1A.mis"); var outputPath = Path.Combine(TestContext.DeploymentDirectory, "directOutput.mis"); var expected = MisFileSerializer.ReadMisFile(inputPath); // Act, MisFileSerializer.WriteMisFile(outputPath, expected); var actual = MisFileSerializer.ReadMisFile(outputPath); // Assert, Assert.AreEqual(expected, actual); File.Delete(outputPath); }
public async override void SaveMission() { var savePicker = new FileSavePicker(); savePicker.SuggestedStartLocation = PickerLocationId.Downloads; savePicker.FileTypeChoices.Add("Commandos Mission File", new List <string>() { ".mis" }); savePicker.SuggestedFileName = MissionName ?? "New Mission"; var file = await savePicker.PickSaveFileAsync(); if (file != null) { var lines = MisFileSerializer.GetMisFileText(Mission); await Windows.Storage.FileIO.WriteLinesAsync(file, lines); } }
public async override void LoadMission() { var openPicker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; openPicker.FileTypeFilter.Add(".mis"); var file = await openPicker.PickSingleFileAsync(); if (file != null) { MissionFilePath = file.Path; var lines = await FileIO.ReadLinesAsync(file); Mission = MisFileSerializer.ReadMisFile(lines); } }
public void MisFile_Read_Write_File_Content_Check() { // Arrange, var inputPath = Path.Combine(TestContext.DeploymentDirectory, "5G1A.mis"); var firstOutputPath = Path.Combine(TestContext.DeploymentDirectory, "firstOutput.mis"); var secondOutputPath = Path.Combine(TestContext.DeploymentDirectory, "secondOutput.mis"); var mission = MisFileSerializer.ReadMisFile(inputPath); // Act, MisFileSerializer.WriteMisFile(firstOutputPath, mission); var expected = File.ReadAllLines(firstOutputPath); mission = MisFileSerializer.ReadMisFile(firstOutputPath); MisFileSerializer.WriteMisFile(secondOutputPath, mission); var actual = File.ReadAllLines(secondOutputPath); // Assert, CollectionAssert.AreEqual(expected, actual); File.Delete(firstOutputPath); File.Delete(secondOutputPath); }
public override void LoadMission() { Mission = MisFileSerializer.ReadMisFile(MissionFilePath); }
public override void SaveMission() { MisFileSerializer.WriteMisFile(MissionName, Mission); }