-
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.
added test project which use the db. Supply sqldb.config to run
- Loading branch information
1 parent
ae55f5b
commit 90765b6
Showing
6 changed files
with
92 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -482,3 +482,4 @@ $RECYCLE.BIN/ | |
|
||
# Vim temporary swap files | ||
*.swp | ||
/BiggerTests/sqlDb.config |
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<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="coverlet.collector" Version="6.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\PCAxis.Sql\PCAxis.Sql.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="sqlDb.config"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="testhost.dll.config"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
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,42 @@ | ||
using System.Configuration; | ||
|
||
using PCAxis.Sql.DbConfig; | ||
|
||
namespace BiggerTests | ||
{ | ||
[TestClass] | ||
public class ConfigTest | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() | ||
{ | ||
//System.Configuration.ConfigurationFileMap configMap = new ConfigurationFileMap("./app.config"); | ||
//System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenMappedMachineConfiguration(configMap); | ||
//var sdfdsz = configuration.AppSettings["dsa"]; | ||
//string value = configuration.AppSettings["TestKey"]; | ||
string path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath; | ||
var k = ConfigurationManager.AppSettings["TestKey"]; | ||
Assert.AreEqual("testvalue", k); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod2() | ||
{ | ||
|
||
var k = ConfigurationManager.AppSettings["dbconfigFile"]; | ||
Assert.AreEqual("SqlDb.config", k); | ||
} | ||
|
||
|
||
|
||
[TestMethod] | ||
public void TestGetsDefaultDatabase() | ||
{ | ||
var dbConf = SqlDbConfigsStatic.DefaultDatabase; | ||
|
||
var langCount = dbConf.GetAllLanguages().Count; | ||
Assert.IsTrue(langCount > 1); | ||
} | ||
|
||
} | ||
} |
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 @@ | ||
global using Microsoft.VisualStudio.TestTools.UnitTesting; |
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 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<appSettings> | ||
<add key="TestKey" value="testvalue"/> | ||
<add key="dbconfigFile" value="SqlDb.config"/> | ||
</appSettings> | ||
</configuration> |
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