-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added interface builder * Changed method builder so it add a semicolon if you set body to null
- Loading branch information
Showing
11 changed files
with
380 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using NUnit.Framework; | ||
using Testura.Code.Builders; | ||
using Testura.Code.Models; | ||
using Testura.Code.Models.Properties; | ||
|
||
namespace Testura.Code.Tests.Builders | ||
{ | ||
[TestFixture] | ||
public class InterfaceBuilderTests | ||
{ | ||
private InterfaceBuilder _interfaceBuilder; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_interfaceBuilder = new InterfaceBuilder("TestInterface", "MyNamespace"); | ||
} | ||
|
||
[Test] | ||
public void Build_WhenGivenClassName_CodeShouldContainClassName() | ||
{ | ||
Assert.IsTrue(_interfaceBuilder.Build().ToString().Contains("TestInterface")); | ||
} | ||
|
||
[Test] | ||
public void Build_WhenGivenNamespace_CodeShouldContainNamespace() | ||
{ | ||
Assert.IsTrue(_interfaceBuilder.Build().ToString().Contains("MyNamespace")); | ||
} | ||
|
||
[Test] | ||
public void Build_WhenGivenAttributes_CodeShouldContainAttributes() | ||
{ | ||
Assert.IsTrue(_interfaceBuilder.WithAttributes(new Attribute("MyAttribute")).Build().ToString().Contains("[MyAttribute]")); | ||
} | ||
|
||
|
||
[Test] | ||
public void Build_WhenGivenProperty_CodeShouldContainProperty() | ||
{ | ||
Assert.IsTrue(_interfaceBuilder.WithProperties(new AutoProperty("MyProperty", typeof(int), PropertyTypes.GetAndSet)).Build().ToString().Contains("intMyProperty{get;set;}")); | ||
} | ||
|
||
[Test] | ||
public void Build_WhenGivenUsing_CodeShouldContainUsing() | ||
{ | ||
Assert.IsTrue(_interfaceBuilder.WithUsings("some.namespace").Build().ToString().Contains("some.namespace")); | ||
} | ||
|
||
|
||
[Test] | ||
public void Build_WhenGivenModifiers_CodeShouldContainModifiers() | ||
{ | ||
Assert.IsTrue(_interfaceBuilder.WithModifiers(Modifiers.Public, Modifiers.Abstract).Build().ToString().Contains("publicabstractinterfaceTestInterface")); | ||
} | ||
|
||
[Test] | ||
public void Build_WhenGivenInheritance_CodeShouldContainInheritance() | ||
{ | ||
var o = _interfaceBuilder.ThatInheritFrom(typeof(int)).Build().ToString(); | ||
Assert.IsTrue(_interfaceBuilder.ThatInheritFrom(typeof(int)).Build().ToString().Contains("TestInterface:int")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.