Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch to main for: upgrading to to .NET Core 9 #21

Merged
merged 7 commits into from
Nov 26, 2024
2 changes: 1 addition & 1 deletion DatenLokator-v2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32519.379
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueDotBrigade.DatenLokator.TestsTools", "Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestsTools.csproj", "{45CCE4A3-EF0E-4D01-A036-EABC7CEA4E88}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueDotBrigade.DatenLokator.TestTools", "Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestTools.csproj", "{45CCE4A3-EF0E-4D01-A036-EABC7CEA4E88}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueDotBrigade.DatenLokator.TestTools-UnitTests", "Tst\BlueDotBrigade.DatenLokator.TestTools-UnitTests\BlueDotBrigade.DatenLokator.TestTools-UnitTests.csproj", "{65CF85B2-561B-4B89-92C4-22C8C4E0B113}"
EndProject
Expand Down
1 change: 1 addition & 0 deletions DomainSpecificTerminology.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ https://msdn.microsoft.com/en-us/library/bb514188.aspx
</Unrecognized>
<Recognized>
<Word>DatenLokator</Word>
<Word>Lokator</Word>
</Recognized>
<Deprecated>
<Term PreferredAlternate=""></Term>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<PackageId>BlueDotBrigade.DatenLokator</PackageId>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
<Authors>BlueDotBrigade;</Authors>
<Copyright>© 2022 Blue Dot Brigade. All rights reserved.</Copyright>
<Copyright>© 2024 Blue Dot Brigade. All rights reserved.</Copyright>
<Owners>Blue Dot Brigade</Owners>
<Title>DatenLokator</Title>
<Summary>Project summary.</Summary>
Expand All @@ -22,9 +22,9 @@
<Company>Blue Dot Brigade</Company>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\..\DomainSpecificTerminology.xml">
Expand Down
6 changes: 3 additions & 3 deletions Src/Demo/Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Platforms>x64</Platforms>
<RootNamespace>Demo</RootNamespace>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
<Authors>BlueDotBrigade;</Authors>
<Copyright>© 2022 Blue Dot Brigade. All rights reserved.</Copyright>
<Copyright>© 2024 Blue Dot Brigade. All rights reserved.</Copyright>
<Owners>Blue Dot Brigade</Owners>
<PackageReleaseNotes>This library was created as part of a demo application for the DatenLokator framework.</PackageReleaseNotes>
<AssemblyName>Demo</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>BlueDotBrigade.DatenLokator.TestTools</RootNamespace>
<Version>2.1.0</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -26,18 +27,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="NamingConventions\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestsTools.csproj" />
<ProjectReference Include="..\..\Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestTools.csproj" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using BlueDotBrigade.DatenLokator.TestTools.IO;
using BlueDotBrigade.DatenLokator.TestTools.NamingConventions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NSubstitute;

/// <summary>
/// These methods are more about exploring the <see cref="Lokator"/> API, to ensure that the library can be extended.
Expand All @@ -14,14 +14,15 @@ public class LokatorApi
[TestMethod]
public void UsingFileManagementStrategy()
{
var fakeFileManagementStrategy = new Mock<IFileManagementStrategy>().Object;
var fakeFileManagementStrategy = Substitute.For<IFileManagementStrategy>();

new Lokator().UsingFileManagementStrategy(fakeFileManagementStrategy);
}

[TestMethod]
public void UsingTestNamingStrategy()
{
var fakeTestNamingStrategy = new Mock<ITestNamingStrategy>().Object;
var fakeTestNamingStrategy = Substitute.For<ITestNamingStrategy>();

new Lokator().UsingTestNamingStrategy(fakeTestNamingStrategy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
using BlueDotBrigade.DatenLokator.TestTools.IO;
using BlueDotBrigade.DatenLokator.TestTools.NamingConventions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NSubstitute;
using System.Collections.Generic;

/// <summary>
/// These test methods are more about exploring the <see cref="Lokator"/> API, to ensure that the library can be extended.
Expand Down Expand Up @@ -32,19 +33,20 @@ public void UseCustomRootDirectory()
{ LokatorConfiguration.RootDirectoryKey, CustomRootDirectory }
};

var directory = new Mock<IOsDirectory>();
directory.Setup(x => x.Exists(It.IsAny<string>())).Returns(true);
var directory = Substitute.For<IOsDirectory>();
directory.Exists(Arg.Any<string>()).Returns(true);

var file = new Mock<IOsFile>();
file.Setup(x => x.Exists(It.IsAny<string>())).Returns((string path) =>
var file = Substitute.For<IOsFile>();
file.Exists(Arg.Any<string>()).Returns((callInfo) =>
{
var path = callInfo.Arg<string>();
return path.StartsWith(CustomRootDirectory);
});

var coordinator = new Coordinator(
file.Object,
file,
new MemberCaseResultNamingStrategy(),
new SubFolderThenGlobal(directory.Object, file.Object),
new SubFolderThenGlobal(directory, file),
new Dictionary<string, object>(),
"Default.txt",
CustomRootDirectory);
Expand All @@ -56,4 +58,4 @@ public void UseCustomRootDirectory()
Assert.IsTrue(sourceFilePath.StartsWith(CustomRootDirectory));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<Platforms>x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestTools.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
{
using System;
using System.IO;
using BlueDotBrigade.DatenLokator.TestTools.IO;
using BlueDotBrigade.DatenLokator.TestTools.NamingConventions;
using BlueDotBrigade.DatenLokator.TestTools.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NSubstitute;

[TestClass]
public class SubFolderThenGlobalTests
Expand All @@ -15,14 +14,14 @@ public class SubFolderThenGlobalTests
[ExpectedException(typeof(ArgumentException))]
public void Setup_InvalidPath_Throws()
{
var osFile = new Mock<IOsFile>();
var osDirectory = new Mock<IOsDirectory>();
var osFile = Substitute.For<IOsFile>();
var osDirectory = Substitute.For<IOsDirectory>();

osDirectory
.Setup(d => d.Exists(It.IsAny<string>()))
.Exists(Arg.Any<string>())
.Returns(false);

var fileManager = new SubFolderThenGlobal(osDirectory.Object, osFile.Object);
var fileManager = new SubFolderThenGlobal(osDirectory, osFile);
fileManager.Setup(@"C:\This\Path\Does\Not\Exist");

Assert.Fail("Setup should have thrown an exception.");
Expand All @@ -31,14 +30,14 @@ public void Setup_InvalidPath_Throws()
[TestMethod]
public void Setup_ValidPath_SetsRootDirectoryPath()
{
var osFile = new Mock<IOsFile>();
var osDirectory = new Mock<IOsDirectory>();
var osFile = Substitute.For<IOsFile>();
var osDirectory = Substitute.For<IOsDirectory>();

osDirectory
.Setup(d => d.Exists(It.IsAny<string>()))
.Exists(Arg.Any<string>())
.Returns(true);

var fileManager = new SubFolderThenGlobal(osDirectory.Object, osFile.Object);
var fileManager = new SubFolderThenGlobal(osDirectory, osFile);
fileManager.Setup(@"C:\New\Root\Directory\Path");

Assert.AreEqual(
Expand All @@ -49,16 +48,16 @@ public void Setup_ValidPath_SetsRootDirectoryPath()
[TestMethod]
public void Setup_ValidPath_SetsGlobalDirectoryPath()
{
var osFile = new Mock<IOsFile>();
var osDirectory = new Mock<IOsDirectory>();
var osFile = Substitute.For<IOsFile>();
var osDirectory = Substitute.For<IOsDirectory>();

osDirectory
.Setup(d => d.Exists(It.IsAny<string>()))
.Exists(Arg.Any<string>())
.Returns(true);

var fileManager = new SubFolderThenGlobal(osDirectory.Object, osFile.Object);
var fileManager = new SubFolderThenGlobal(osDirectory, osFile);
fileManager.Setup(@"C:\New\Root\Directory\Path");

Assert.AreEqual(
@"C:\New\Root\Directory\Path\.Global",
fileManager.GlobalDirectoryPath);
Expand All @@ -69,27 +68,27 @@ public void GetFilePath_NewRootDirectory_ReturnsCorrectPath()
{
var thisClassPath = Path.Combine(AssemblyHelper.ProjectDirectoryPath, @"IO\SubFolderThenGlobalTests.cs");

var osFile = new Mock<IOsFile>();
var osFile = Substitute.For<IOsFile>();
osFile
.Setup(d => d.Exists(It.IsAny<string>()))
.Exists(Arg.Any<string>())
.Returns(true);

var osDirectory = new Mock<IOsDirectory>();
var osDirectory = Substitute.For<IOsDirectory>();
osDirectory
.Setup(d => d.Exists(It.IsAny<string>()))
.Exists(Arg.Any<string>())
.Returns(true);

var namingStrategy = new Mock<ITestNamingStrategy>();
var namingStrategy = Substitute.For<ITestNamingStrategy>();

var fileManager = new SubFolderThenGlobal(osDirectory.Object, osFile.Object);
var fileManager = new SubFolderThenGlobal(osDirectory, osFile);
fileManager.Setup(@"C:\SampleData\");

Assert.AreEqual(
@"C:\SampleData\IO\SubFolderThenGlobalTests\FooBar.txt",
fileManager.GetFilePath(
namingStrategy.Object,
namingStrategy,
"FooBar.txt",
thisClassPath));
}
}
}
}
17 changes: 8 additions & 9 deletions Tst/DemoTests/DemoTests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Demo</RootNamespace>
<PackageId>BlueDotBrigade.DatenLokator.DemoTests</PackageId>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
<Authors>BlueDotBrigade;</Authors>
<Company>Blue Dot Brigade;</Company>
<Description>Simplifies testing by automatically selecting the appropriate input data for a given test case.</Description>
<Copyright>© 2022 Blue Dot Brigade. All rights reserved.</Copyright>
<Copyright>© 2024 Blue Dot Brigade. All rights reserved.</Copyright>
<RepositoryUrl>https://dev.azure.com/BlueDotBrigade/OpenSource/_git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>BlueDotBrigade</PackageTags>
Expand All @@ -20,13 +20,12 @@
<AssemblyName>DemoTests</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestsTools.csproj" />
<ProjectReference Include="..\..\Src\BlueDotBrigade.DatenLokator.TestTools\BlueDotBrigade.DatenLokator.TestTools.csproj" />
<ProjectReference Include="..\..\Src\Demo\Demo.csproj" />
</ItemGroup>
<ItemGroup>
Expand All @@ -41,4 +40,4 @@
<None Include=".Daten\Serialization\XmlSerializerTests~ZIP\SuperBattleDroid.xml" />
<None Include=".Daten\.Global\PitDroid.xml" />
</ItemGroup>
</Project>
</Project>
Loading