Skip to content

Commit

Permalink
Updating for .NET Core
Browse files Browse the repository at this point in the history
  • Loading branch information
trayburn committed Sep 11, 2019
1 parent fdaa3f0 commit 1a5dc9a
Show file tree
Hide file tree
Showing 48 changed files with 279 additions and 1,411 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ _ReSharper*
Index.dat
Storage.dat
packages
.cr/
.vs/

2 changes: 2 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This work is licensed by Improving under the following license:
http://creativecommons.org/licenses/by-nc-sa/3.0/
1 change: 0 additions & 1 deletion README.markdown

This file was deleted.

8 changes: 0 additions & 8 deletions README.txt

This file was deleted.

4 changes: 0 additions & 4 deletions src/.nuget/packages.config

This file was deleted.

10 changes: 0 additions & 10 deletions src/Local.testsettings

This file was deleted.

33 changes: 10 additions & 23 deletions src/Squire.sln
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.29209.152
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{367740AC-F554-4B7D-89E5-13F5422A9B09}"
ProjectSection(SolutionItems) = preProject
..\README.txt = ..\README.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squire", "Squire\Squire.csproj", "{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{E140EBEB-8567-48B3-B9A5-20261120ED6C}"
ProjectSection(SolutionItems) = preProject
.nuget\packages.config = .nuget\packages.config
EndProjectSection
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squire", "Squire\Squire.csproj", "{E7BB217B-6F1A-4DAF-9E74-5892A25D0CEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Debug|x86.ActiveCfg = Debug|x86
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Debug|x86.Build.0 = Debug|x86
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Release|Any CPU.Build.0 = Release|Any CPU
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Release|x86.ActiveCfg = Release|x86
{912DC9CB-8F72-4EE2-99F9-64F8592C85CE}.Release|x86.Build.0 = Release|x86
{E7BB217B-6F1A-4DAF-9E74-5892A25D0CEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7BB217B-6F1A-4DAF-9E74-5892A25D0CEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7BB217B-6F1A-4DAF-9E74-5892A25D0CEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7BB217B-6F1A-4DAF-9E74-5892A25D0CEF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6F667BE2-29D7-4EC0-8E7E-919A0C92918B}
EndGlobalSection
GlobalSection(SpecExplorer.ActivityCompletionStatus) = preSolution
SpecExplorer.ActivityCompletionStatus = TestExisting: ;ModelFromScratch:
EndGlobalSection
Expand Down
6 changes: 0 additions & 6 deletions src/Squire.vsmdi

This file was deleted.

4 changes: 2 additions & 2 deletions src/Squire/ConsoleKihon.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Squire.Framework;
using Squire.Framework.Abstractions;

Expand All @@ -13,7 +13,7 @@ namespace Squire
* methods and properties as System.Console, so anything you can
* do to one, you can do to the other.
*/
[TestFixture]
[TestClass]
public class ConsoleKihon : ConsoleKihonBase
{
protected override void Write_FooBar_To_The_Console(IConsoleWrapper console)
Expand Down
4 changes: 2 additions & 2 deletions src/Squire/ControlStructureKihon.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using NUnit.Framework;
using Squire.Framework;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Squire
{
[TestFixture]
[TestClass]
public class ControlStructureKihon : ControlStructuresKihonBase
{
/*
Expand Down
26 changes: 26 additions & 0 deletions src/Squire/DelegatesKihon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Squire.Framework;
using System;
using System.Linq.Expressions;

namespace Squire
{
[TestClass]
public class DelegatesKihon : DelegatesKihonBase
{
public override Action Return_An_Action_That_Calls_Hit_On_a(ITarget a)
{
throw new NotImplementedException();
}

public override Action<ITarget> Return_An_Action_That_Calls_Hit_On_Its_Parameter()
{
throw new NotImplementedException();
}

public override Expression<Func<bool>> Return_An_Expression_That_Is_a_or_b(bool a, bool b)
{
throw new NotImplementedException();
}
}
}
4 changes: 2 additions & 2 deletions src/Squire/Framework/BaseDataKihon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
using System.Data.SQLite;
using System.Text;
using System.Data;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Squire.Framework
{

[TestFixture]
[TestClass]
public abstract class BaseDataKihon : BaseKihon, IDisposable
{
protected SQLiteConnection dbConn;
Expand Down
17 changes: 4 additions & 13 deletions src/Squire/Framework/BaseKihon.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
using System;
using Castle.Windsor;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Squire.Framework
{

[TestFixture]
[TestClass]
public abstract class BaseKihon
{
private IWindsorContainer container;

[SetUp]
[TestInitialize]
public void Initialize()
{
container = new WindsorContainer();
RegisterComponents(container);
BeforeEachTest();
}

[TearDown]
[TestCleanup]
public void Cleanup()
{
AfterEachTest();
}

protected virtual void RegisterComponents(IWindsorContainer container)
{
}
protected virtual void BeforeEachTest()
{
}
protected virtual void AfterEachTest()
{
}

}
}
47 changes: 25 additions & 22 deletions src/Squire/Framework/ConsoleKihonBase.cs
Original file line number Diff line number Diff line change
@@ -1,70 +1,73 @@
using System;

using NUnit.Framework;
using Squire.Framework.Abstractions;
using Rhino.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace Squire.Framework
{
[TestFixture]
[TestClass]
public abstract class ConsoleKihonBase : BaseKihon
{
private IConsoleWrapper console;
private Mock<IConsoleWrapper> mockConsole;

protected override void BeforeEachTest()
{
base.BeforeEachTest();
console = MockRepository.GenerateMock<IConsoleWrapper>();
mockConsole = new Mock<IConsoleWrapper>();
}
[Test]
[TestMethod]
public void Write_FooBar_To_The_Console()
{
// Arrange

mockConsole.Setup(e => e.Write("FooBar"))
.Verifiable("Did not call Write correctly");

// Act
Write_FooBar_To_The_Console(console);
Write_FooBar_To_The_Console(mockConsole.Object);

// Assert
console.AssertWasCalled(c => c.Write("FooBar"));
mockConsole.Verify();
}

[Test]
[TestMethod]
public void WriteLine_FooBar_To_The_Console()
{
// Arrange

mockConsole.Setup(e => e.WriteLine("FooBar"))
.Verifiable("Did not call WriteLine correctly");

// Act
WriteLine_FooBar_To_The_Console(console);
WriteLine_FooBar_To_The_Console(mockConsole.Object);

// Assert
console.AssertWasCalled(c => c.WriteLine("FooBar"));
mockConsole.Verify();
}

[Test]
[TestMethod]
public void Write_Foo_In_Blue_To_The_Console()
{
// Arrange


mockConsole.SetupSet(e => e.ForegroundColor = ConsoleColor.Blue)
.Verifiable("Did not set foreground color correctly.");
mockConsole.Setup(e => e.Write("Foo"))
.Verifiable("Did not call Write correctly");
// Act
Write_Foo_In_Blue_To_The_Console(console);
Write_Foo_In_Blue_To_The_Console(mockConsole.Object);

// Assert
console.AssertWasCalled(c => c.ForegroundColor = ConsoleColor.Blue);
console.AssertWasCalled(c => c.Write("Foo"));
mockConsole.Verify();
}

[Test]
[TestMethod]
public void Read_Line_From_Console_And_Return_Value()
{
// Arrange
string expected = "This is a test";
console.Stub(c => c.ReadLine()).Return(expected);
mockConsole.Setup(c => c.ReadLine()).Returns(expected);

// Act
var actual = Read_Line_From_Console_And_Return_Value(console);
var actual = Read_Line_From_Console_And_Return_Value(mockConsole.Object);

// Assert
Assert.AreEqual(expected, actual);
Expand Down
77 changes: 0 additions & 77 deletions src/Squire/Framework/ConsoleKihonStructure.cs

This file was deleted.

Loading

0 comments on commit 1a5dc9a

Please sign in to comment.