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
40 changes: 40 additions & 0 deletions src/TestabilityKata.Tests/CustomFileWriterTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NSubstitute;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace TestabilityKata.Tests
{
[TestClass]
public class CustomFileWriterTest
{
[TestMethod]
public void WhenCreatingFileAnEmailIsSentOut()
{
var fakeMailSender = Substitute.For<IMailSender>();

const string testFilePath = @"C:\WhenCreatingFileAnEmailIsSentOut.txt";

//if the existing file exists, delete it before running the test, since
//we need to get to the point where a new file is created.
if(File.Exists(testFilePath))
{
File.SetAttributes(testFilePath, FileAttributes.Normal);
File.Delete(testFilePath);
}

var customFileWriter = new CustomFileWriter(
fakeMailSender,
testFilePath);
customFileWriter.AppendLine("Some line");

fakeMailSender
.Received()
.SendMail(
Arg.Any<string>(),
Arg.Any<string>());
}
}
}
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>