Skip to content

Commit

Permalink
テストコードを追加。
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamurakko committed Feb 5, 2023
1 parent b4f5154 commit 737643d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
8 changes: 7 additions & 1 deletion SampleLib/SampleLib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleLib", "SampleLib\SampleLib.csproj", "{CC404675-E152-4C4D-B871-F4BCEDEB9908}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleLib", "SampleLib\SampleLib.csproj", "{CC404675-E152-4C4D-B871-F4BCEDEB9908}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleLibTest", "SampleLibTest\SampleLibTest.csproj", "{DED3140B-E9A3-43B8-88F4-B703261C8913}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +17,10 @@ Global
{CC404675-E152-4C4D-B871-F4BCEDEB9908}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC404675-E152-4C4D-B871-F4BCEDEB9908}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC404675-E152-4C4D-B871-F4BCEDEB9908}.Release|Any CPU.Build.0 = Release|Any CPU
{DED3140B-E9A3-43B8-88F4-B703261C8913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DED3140B-E9A3-43B8-88F4-B703261C8913}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DED3140B-E9A3-43B8-88F4-B703261C8913}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DED3140B-E9A3-43B8-88F4-B703261C8913}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
32 changes: 32 additions & 0 deletions SampleLib/SampleLibTest/SampleLibTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<Authors>nakamurakko</Authors>

<Copyright>@ nakamurakko</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SampleLib\SampleLib.csproj" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions SampleLib/SampleLibTest/UnitTestGreeting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using SampleLib;
using Xunit;

namespace SampleLibTest
{
public class UnitTestGreeting
{
[Fact]
public async void TestGreeting()
{
var reply = await new Greeting().Reply("hoge");

Assert.True(reply is string);
Assert.Equal("Hello hoge.", reply);
}
}
}

0 comments on commit 737643d

Please sign in to comment.