mirror of
https://github.com/AlexMacocian/Sybil.git
synced 2026-07-15 15:19:59 +00:00
Support for filescoped namespaces
Closes #7 Support for compilation units Closes #8
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using FluentAssertions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
|
||||
namespace Sybil.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class CompilationUnitTests
|
||||
{
|
||||
private const string UsingSystemWindows = "using System.Windows;";
|
||||
|
||||
private readonly CompilationUnitBuilder compilationUnitBuilder = new();
|
||||
|
||||
[TestMethod]
|
||||
public void WithUsing_NullUsing_ThrowsArgumentNullException()
|
||||
{
|
||||
var action = () =>
|
||||
{
|
||||
this.compilationUnitBuilder.WithUsing(null);
|
||||
};
|
||||
|
||||
action.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WithNamespace_NullNamespaceBuilder_ThrowsArgumentNullException()
|
||||
{
|
||||
var action = () =>
|
||||
{
|
||||
this.compilationUnitBuilder.WithNamespace(null);
|
||||
};
|
||||
|
||||
action.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WithUsing_ReturnsExpected()
|
||||
{
|
||||
var result = this.compilationUnitBuilder.WithUsing("System.Windows").Build().ToFullString();
|
||||
|
||||
result.Should().Be(UsingSystemWindows);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user