Skip to content

Commit

Permalink
Merge branch 'release/v2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtellnes committed Apr 12, 2021
2 parents d55d4c1 + 8d3c996 commit 4b9b3e2
Show file tree
Hide file tree
Showing 292 changed files with 18,882 additions and 3,037 deletions.
30 changes: 0 additions & 30 deletions src/Arkivverket.Arkade.CLI.Tests/Noark5TestListGeneratorTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Xunit;
using System;
using System.Globalization;
using System.IO;
using Arkivverket.Arkade.Core.Languages;
using Arkivverket.Arkade.Core.Resources;
using FluentAssertions;

namespace Arkivverket.Arkade.CLI.Tests
{
public class Noark5TestSelectionFileGeneratorTests
{
[Fact]
public void GenerateTest()
{
const SupportedLanguage language = SupportedLanguage.en;

OutputFileNames.Culture = new CultureInfo(language.ToString());

string workingDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
string testFilePath = Path.Combine(workingDirectoryPath, OutputFileNames.Noark5TestSelectionFile);

if (File.Exists(testFilePath))
File.Delete(testFilePath);

Noark5TestSelectionFileGenerator.Generate(testFilePath, language);

File.Exists(testFilePath).Should().BeTrue();

var testSelectionFileContent = new StringReader(File.ReadAllText(testFilePath));

testSelectionFileContent.ReadLine().Should().Be("# " + OutputStrings.Noark5TestSelectionFileHeading);

File.Delete(testFilePath);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

namespace Arkivverket.Arkade.CLI.Tests
{
public class Noark5TestListReaderTests
public class Noark5TestSelectionFileReaderTests
{
[Fact]
public void ParseFileContentTest()
{
var content = new[] {"N5.13", "#N5.27", "N5.63", "N5.ab", "A.15"};

List<TestId> testIds = Noark5TestListReader.ParseFileContent(content);
List<TestId> testIds = Noark5TestSelectionFileReader.ParseFileContent(content);

testIds.Should().Contain(TestId.Create("N5.13"));
testIds.Should().Contain(TestId.Create("N5.63"));
Expand Down
45 changes: 27 additions & 18 deletions src/Arkivverket.Arkade.CLI.Tests/ProgramTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using Arkivverket.Arkade.Core.Base;
using Arkivverket.Arkade.Core.Languages;
using Arkivverket.Arkade.Core.Resources;
using Arkivverket.Arkade.Core.Util;
using Xunit;
using FluentAssertions;
Expand All @@ -10,19 +13,24 @@ namespace Arkivverket.Arkade.CLI.Tests
{
public class ProgramTests : IDisposable
{
// Setup language
private const SupportedLanguage Language = SupportedLanguage.en;

// Establish needed paths:
private static readonly string workingDirectoryPath;
private static readonly string metadataFilePath;
private static readonly string noark5TestListPath;
private static readonly string noark5TestSelectionFilePath;
private static readonly string testDataDirectoryPath;
private static readonly string archiveDirectoryPath;
private static readonly string outputDirectoryPath;

static ProgramTests()
{
OutputFileNames.Culture = new CultureInfo(Language.ToString());

workingDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
metadataFilePath = Path.Combine(workingDirectoryPath, ArkadeConstants.MetadataFileName);
noark5TestListPath = Path.Combine(workingDirectoryPath, ArkadeConstants.Noark5TestListFileName);
metadataFilePath = Path.Combine(workingDirectoryPath, OutputFileNames.MetadataFile);
noark5TestSelectionFilePath = Path.Combine(workingDirectoryPath, OutputFileNames.Noark5TestSelectionFile);
testDataDirectoryPath = Path.Combine(workingDirectoryPath, "TestData");
archiveDirectoryPath = Path.Combine(testDataDirectoryPath, "N5-archive");
outputDirectoryPath = Path.Combine(testDataDirectoryPath, "output");
Expand All @@ -40,17 +48,17 @@ public void GenerateCommandTest()
{
"generate",
"-m",
"-l",
"-s",
"-o", workingDirectoryPath
});

bool metadataWasGenerated = File.Exists(metadataFilePath);
bool noark5TestListGenerated = File.Exists(noark5TestListPath);
bool noark5TestSelectionFileGenerated = File.Exists(noark5TestSelectionFilePath);

// Control result:

metadataWasGenerated.Should().BeTrue();
noark5TestListGenerated.Should().BeTrue();
noark5TestSelectionFileGenerated.Should().BeTrue();
}

[Fact(Skip = "IO-issues")]
Expand All @@ -59,7 +67,7 @@ public void TestCommandTest()
{
// Prepare needed files and/or directories

Noark5TestListGenerator.Generate(ArkadeConstants.Noark5TestListFileName);
Noark5TestSelectionFileGenerator.Generate(OutputFileNames.Noark5TestSelectionFile, Language);
Directory.CreateDirectory(outputDirectoryPath);

// Run commands and store results:
Expand All @@ -71,11 +79,11 @@ public void TestCommandTest()
"-t", "noark5",
"-p", testDataDirectoryPath,
"-o", outputDirectoryPath,
"-l", noark5TestListPath
"-s", noark5TestSelectionFilePath
});

FileSystemInfo[] outputDirectoryItems = new DirectoryInfo(outputDirectoryPath).GetFileSystemInfos();
bool testReportWasCreated = outputDirectoryItems.Any(item => item.Name.StartsWith("Arkaderapport"));
bool testReportWasCreated = outputDirectoryItems.Any(item => item.Name.StartsWith("Arkade-report"));

// Control result:

Expand All @@ -88,7 +96,7 @@ public void PackCommandTest()
{
// Prepare needed files and/or directories

new MetadataExampleGenerator().Generate(ArkadeConstants.MetadataFileName);
new MetadataExampleGenerator().Generate(OutputFileNames.MetadataFile);
Directory.CreateDirectory(outputDirectoryPath);

// Run commands and store results:
Expand All @@ -105,7 +113,7 @@ public void PackCommandTest()

FileSystemInfo[] outputDirectoryItems = new DirectoryInfo(outputDirectoryPath).GetFileSystemInfos();
bool packageWasCreated = outputDirectoryItems.Any(item =>
item.Name.StartsWith(ArkadeConstants.DirectoryNameResultOutputContainer));
item.Name.StartsWith(OutputFileNames.ResultOutputDirectory));

// Control result:

Expand All @@ -118,8 +126,8 @@ public void ProcessCommandTest()
{
// Prepare needed files and/or directories

new MetadataExampleGenerator().Generate(ArkadeConstants.MetadataFileName);
Noark5TestListGenerator.Generate(ArkadeConstants.Noark5TestListFileName);
new MetadataExampleGenerator().Generate(OutputFileNames.MetadataFile);
Noark5TestSelectionFileGenerator.Generate(OutputFileNames.Noark5TestSelectionFile, Language);
Directory.CreateDirectory(outputDirectoryPath);

// Run commands and store results:
Expand All @@ -132,13 +140,14 @@ public void ProcessCommandTest()
"-m", metadataFilePath,
"-p", testDataDirectoryPath,
"-o", outputDirectoryPath,
"-l", noark5TestListPath
"-s", noark5TestSelectionFilePath,
"-l", "nb"
});

FileSystemInfo[] outputDirectoryItems = new DirectoryInfo(outputDirectoryPath).GetFileSystemInfos();
bool testReportWasCreated = outputDirectoryItems.Any(item => item.Name.StartsWith("Arkaderapport"));
bool testReportWasCreated = outputDirectoryItems.Any(item => item.Name.StartsWith("Arkade-rapport"));
bool packageWasCreated = outputDirectoryItems.Any(item =>
item.Name.StartsWith(ArkadeConstants.DirectoryNameResultOutputContainer));
item.Name.StartsWith(OutputFileNames.ResultOutputDirectory));

// Control results:

Expand All @@ -148,8 +157,8 @@ public void ProcessCommandTest()

private static void ClearAllPaths()
{
if (File.Exists(noark5TestListPath))
File.Delete(noark5TestListPath);
if (File.Exists(noark5TestSelectionFilePath))
File.Delete(noark5TestSelectionFilePath);

if (File.Exists(metadataFilePath))
File.Delete(metadataFilePath);
Expand Down
7 changes: 5 additions & 2 deletions src/Arkivverket.Arkade.CLI/Arkivverket.Arkade.CLI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down Expand Up @@ -65,8 +65,11 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="OutputStrings.nb-NO.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="OutputStrings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>OutputStrings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
Expand Down
Loading

0 comments on commit 4b9b3e2

Please sign in to comment.