-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Szpi/Settings
Settings
- Loading branch information
Showing
64 changed files
with
889 additions
and
154 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
7 changes: 7 additions & 0 deletions
7
...per/IniWrapper.IntegrationTests/Main/Configuration/Properties/ComplexNullConfiguration.cs
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,7 @@ | ||
namespace IniWrapper.IntegrationTests.Main.Configuration.Properties | ||
{ | ||
public class ComplexNullConfiguration | ||
{ | ||
public NullableConfiguration NullableConfiguration { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...r/IniWrapper.IntegrationTests/Main/Configuration/Properties/DefaultValuesConfiguration.cs
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,17 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace IniWrapper.IntegrationTests.Main.Configuration.Properties | ||
{ | ||
public static class DefaultValuesConfigurationConsts | ||
{ | ||
public const int DefaultInt = 100; | ||
public const string DefaultString = "StringDefault"; | ||
public const string DefaultList = "10,11,12,13"; | ||
} | ||
public class DefaultValuesConfiguration | ||
{ | ||
public int DefaultInt { get; set; } = DefaultValuesConfigurationConsts.DefaultInt; | ||
public string DefaultString { get; set; } = DefaultValuesConfigurationConsts.DefaultString; | ||
public List<int> DefaultList { get; set; } = new List<int>() { 10, 11, 12, 13 }; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...rapper.IntegrationTests/Main/Configuration/Properties/TwoDepthNullComplexConfiguration.cs
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,7 @@ | ||
namespace IniWrapper.IntegrationTests.Main.Configuration.Properties | ||
{ | ||
public class TwoDepthNullComplexConfiguration | ||
{ | ||
public ComplexNullConfiguration ComplexTestConfiguration { get; set; } | ||
} | ||
} |
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
...pper/IniWrapper.IntegrationTests/Main/Read/Properties/IniWrapperReadDefaultValuesTests.cs
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,36 @@ | ||
using System.Collections.Generic; | ||
using FluentAssertions; | ||
using IniWrapper.IntegrationTests.Main.Configuration.Properties; | ||
using IniWrapper.IntegrationTests.MockParser; | ||
using IniWrapper.ParserWrapper; | ||
using IniWrapper.Wrapper; | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
|
||
namespace IniWrapper.IntegrationTests.Main.Read.Properties | ||
{ | ||
[TestFixture] | ||
public class IniWrapperReadDefaultValuesTests | ||
{ | ||
private IIniWrapper _iniWrapper; | ||
|
||
private IIniParser _iniParser; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_iniParser = Substitute.For<IIniParser>(); | ||
_iniWrapper = MockWrapperFactory.CreateWithFileSystem(_iniParser); | ||
} | ||
|
||
[Test] | ||
public void SaveConfiguration_ShouldSaveCorrectDefaultValues() | ||
{ | ||
var result = _iniWrapper.LoadConfiguration<DefaultValuesConfiguration>(); | ||
|
||
result.DefaultInt.Should().Be(DefaultValuesConfigurationConsts.DefaultInt); | ||
result.DefaultString.Should().Be(DefaultValuesConfigurationConsts.DefaultString); | ||
result.DefaultList.Should().BeEquivalentTo(new List<int> { 10, 11, 12, 13 }); | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
IniWrapper/IniWrapper.IntegrationTests/Main/Read/WrongFormat/ReadingEnumOutOfRangeTests.cs
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,35 @@ | ||
using FluentAssertions; | ||
using IniWrapper.IntegrationTests.Main.Configuration.Properties; | ||
using IniWrapper.IntegrationTests.MockParser; | ||
using IniWrapper.ParserWrapper; | ||
using IniWrapper.Wrapper; | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
|
||
namespace IniWrapper.IntegrationTests.Main.Read.WrongFormat | ||
{ | ||
[TestFixture] | ||
public class ReadingEnumOutOfRangeTests | ||
{ | ||
private IIniWrapper _iniWrapper; | ||
|
||
private IIniParser _iniParser; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_iniParser = Substitute.For<IIniParser>(); | ||
_iniWrapper = MockWrapperFactory.CreateWithFileSystem(_iniParser); | ||
} | ||
|
||
[Test] | ||
public void LoadConfiguration_CorrectEnumOutOfRange() | ||
{ | ||
_iniParser.Read(nameof(TestConfiguration), nameof(TestConfiguration.TestEnum)).Returns("1000"); | ||
|
||
var result = _iniWrapper.LoadConfiguration<TestConfiguration>(); | ||
|
||
result.TestEnum.Should().Be((TestEnum)1000); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.