Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove newline in update file (#114)
* Remove the empty line from the version information file. See https://keepass.info/help/v2_dev/plg_index.html#upd * Add version file tests
- Loading branch information
1 parent
a9fc816
commit ae29600
Showing
3 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using FluentAssertions; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace KeeTrayTOTP.Tests | ||
{ | ||
[TestClass] | ||
public class VersionInformationTests | ||
{ | ||
private readonly string[] VersionInformationLines = File.ReadAllLines("version_manifest.txt"); | ||
|
||
[TestMethod] | ||
public void VersionFile_ShouldHaveCorrectLength() | ||
{ | ||
VersionInformationLines.Should().HaveCountGreaterOrEqualTo(3, "File should be a minimum of 3 lines"); | ||
} | ||
|
||
[TestMethod] | ||
public void VersionFile_ShouldNotContainEmptyLines() | ||
{ | ||
VersionInformationLines.Should().NotContain("", "File should not contain empty lines"); | ||
} | ||
|
||
[TestMethod] | ||
public void VersionFile_ShouldStartAndEndWithSeparators() | ||
{ | ||
var separator = VersionInformationLines.First(); | ||
separator.Should().HaveLength(1); | ||
VersionInformationLines.Last().Should().Be(separator, "File should start and end with the same separator"); | ||
} | ||
|
||
[TestMethod] | ||
public void VersionFile_ShouldContainSingleEntryForPluginWithCurrentVersion() | ||
{ | ||
var separatorArray = new[] { VersionInformationLines.First() }; | ||
var pluginLines = VersionInformationLines.Except(separatorArray); | ||
pluginLines.Should().HaveCount(1); | ||
|
||
var updateParts = pluginLines.Single().Split(separatorArray, System.StringSplitOptions.RemoveEmptyEntries); | ||
updateParts.Should().HaveCount(2); | ||
|
||
var assembly = typeof(KeeTrayTOTPExt).Assembly; | ||
var assemblyFileVersionAttribute = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>(); | ||
var assemblyTitleAttribute = assembly.GetCustomAttribute<AssemblyTitleAttribute>(); | ||
|
||
updateParts.First().Should().Be(assemblyTitleAttribute.Title, "First part should equal the plugin name"); | ||
updateParts.Last().Should().Be(assemblyFileVersionAttribute.Version, "Last part should equal the current plugin version."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
: | ||
KeeTrayTOTP:0.103.0.0 | ||
|
||
: |