- jonno_simpletestrunner_demo.zip
- Jonno Nunit Helper.AddIn
- Jonno.AddIns.Entities.dll
- Jonno.AddIns.Logic.VisualStudioSpecific.dll
- Jonno.AddIns.NunitHelper.dll
- Jonno.Extensions.dll
- Jonno.SimpleTestRunner.Entities.dll
- Jonno.SimpleTestRunner.exe
- Jonno.SimpleTestRunner.Logic.dll
- Jonno.Utilities.dll
- test framework helper options.xml
- jonno_simpletestrunner_src.zip
- Jonno Nunit Helper.AddIn
- Jonno.AddIns.Entities.UnitTests
- Jonno.AddIns.Entities
- Jonno.AddIns.Logic.EnvDTE
- Jonno.AddIns.NunitHelper
- Jonno.Extensions.UnitTests
- Jonno.Extensions
- Jonno.Logic.SimpleTestRunner
- Jonno.SimpleTestRunner.Entities
- Jonno.SimpleTestRunner
- Jonno.Utilities
- Nunit helper.sln
|
//-------------------------------------------------------------------------------------
// <copyright file='CodeFileTests.cs' company='Jonno'>
// Copyright (c) Paul Johnson 2009 (email:paulmichael.johnson@gmail.com)
// Code is released under The Code Project Open License (CPOL).
// </copyright>
//-------------------------------------------------------------------------------------
namespace Jonno.AddIns.Entities.UnitTests
{
using Jonno.AddIns.Entities;
using NUnit.Framework;
[TestFixture]
public class CodeFileTests
{
/// <summary>
/// The system under test;
/// </summary>
private CodeFile sut;
[Test]
public void IfFileIsAssemblyInfoShouldSetFlag()
{
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.cs");
Assert.That(this.sut.IsAssemblyInfo, Is.EqualTo(true), "true");
this.sut = new MockCodeFile(@"c:\swsws\sws\Someclass.cs");
Assert.That(this.sut.IsAssemblyInfo, Is.EqualTo(false), "false");
}
[Test]
public void IfFileIsCSharpShouldSetFlag()
{
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.cs");
Assert.That(this.sut.IsCSharpFile, Is.EqualTo(true), "true");
this.sut = new MockCodeFile(@"c:\swsws\sws\Someclass.vb");
Assert.That(this.sut.IsCSharpFile, Is.EqualTo(false), "false");
}
[Test]
public void IfFileIsVBShouldSetFlag()
{
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.vb");
Assert.That(this.sut.IsVBFile, Is.EqualTo(true), "true");
this.sut = new MockCodeFile(@"c:\swsws\sws\Someclass.cs");
Assert.That(this.sut.IsVBFile, Is.EqualTo(false), "false");
}
[Test]
public void ShouldSetExtension()
{
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.vb");
Assert.That(this.sut.Extension, Is.EqualTo(".vb"));
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.cs");
Assert.That(this.sut.Extension, Is.EqualTo(".cs"));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeXML.xml");
Assert.That(this.sut.Extension, Is.EqualTo(".xml"));
}
[Test]
public void ShouldSetFilenameWithoutExtension()
{
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.vb");
Assert.That(this.sut.FileNameWithoutExtension, Is.EqualTo("AssemblyInfo"));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeClass.cs");
Assert.That(this.sut.FileNameWithoutExtension, Is.EqualTo("SomeClass"));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeXML.xml");
Assert.That(this.sut.FileNameWithoutExtension, Is.EqualTo("SomeXML"));
}
[Test]
public void ShouldSetShortname()
{
this.sut = new MockCodeFile(@"c:\swsws\sws\AssemblyInfo.vb");
Assert.That(this.sut.ShortName, Is.EqualTo("AssemblyInfo.vb"));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeClass.cs");
Assert.That(this.sut.ShortName, Is.EqualTo("SomeClass.cs"));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeXML.xml");
Assert.That(this.sut.ShortName, Is.EqualTo("SomeXML.xml"));
}
[Test]
public void IfVborCSharpFileShouldGetText()
{
var expected = "Public class Paul { public void jjj() { } }";
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeClass.cs", expected);
Assert.That(this.sut.Text, Is.EqualTo(expected));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeClass.vb", expected);
Assert.That(this.sut.Text, Is.EqualTo(expected));
this.sut = new MockCodeFile(@"c:\swsws\sws\SomeXMl.xml", expected);
Assert.That(this.sut.Text, Is.EqualTo(string.Empty));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have over 15 years of development experience, in many different languages, programming styles and platforms. Currently working as a C# coder, and residing in north Herts in the UK. I love lean software development and anything that reduces a grind to leave more time for useful coding!