Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/TestabilityKata.Tests/ProgramTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Autofac;
using FluffySpoon.Testing.Autofake;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NSubstitute;

namespace TestabilityKata.Tests
{
Expand All @@ -10,8 +11,23 @@ public class ProgramTest
[TestMethod]
public void ProgramSendsEmailWhenStartingUp()
{
//problem: we certainly don't want to send e-mails out
Program.Main(new string[0]);
var fakeMailSender = Substitute.For<IMailSender>();
var fakeLogger = Substitute.For<ILogger>();

var program = new Program(
fakeLogger,
fakeMailSender);

program.Run();

//we here make sure that SendMail was called
//with the mail body "Program has started." and
//any e-mail address (since that is not important for this test)
fakeMailSender
.Received()
.SendMail(
Arg.Any<string>(),
"Program has started.");
}

[TestMethod]
Expand Down
12 changes: 6 additions & 6 deletions src/TestabilityKata.Tests/TestabilityKata.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluffySpoon.Testing.Autofake.Autofac" Version="1.0.5" />
<PackageReference Include="FluffySpoon.Testing.Autofake.NSubstitute" Version="1.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
<PackageReference Include="FluffySpoon.Testing.Autofake.Autofac" Version="1.34.0" />
<PackageReference Include="FluffySpoon.Testing.Autofake.NSubstitute" Version="1.34.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/TestabilityKata/TestabilityKata.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

</Project>