diff --git a/src/TestabilityKata.Tests/ProgramTest.cs b/src/TestabilityKata.Tests/ProgramTest.cs index 322104b..d4a3b19 100644 --- a/src/TestabilityKata.Tests/ProgramTest.cs +++ b/src/TestabilityKata.Tests/ProgramTest.cs @@ -1,6 +1,7 @@ using Autofac; using FluffySpoon.Testing.Autofake; using Microsoft.VisualStudio.TestTools.UnitTesting; +using NSubstitute; namespace TestabilityKata.Tests { @@ -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(); + var fakeLogger = Substitute.For(); + + 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(), + "Program has started."); } [TestMethod] diff --git a/src/TestabilityKata.Tests/TestabilityKata.Tests.csproj b/src/TestabilityKata.Tests/TestabilityKata.Tests.csproj index f8c14f3..14ce7f0 100644 --- a/src/TestabilityKata.Tests/TestabilityKata.Tests.csproj +++ b/src/TestabilityKata.Tests/TestabilityKata.Tests.csproj @@ -1,17 +1,17 @@ - netcoreapp2.0 + net6.0 false - - - - - + + + + + diff --git a/src/TestabilityKata/TestabilityKata.csproj b/src/TestabilityKata/TestabilityKata.csproj index ce1697a..41f1d5a 100644 --- a/src/TestabilityKata/TestabilityKata.csproj +++ b/src/TestabilityKata/TestabilityKata.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + net6.0