Skip to content

Commit

Permalink
Cleanup and add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sboulema committed Mar 1, 2017
1 parent 080b072 commit a695244
Show file tree
Hide file tree
Showing 35 changed files with 145 additions and 463 deletions.
73 changes: 0 additions & 73 deletions CodeNav.Nunit/CodeNav.Nunit.csproj

This file was deleted.

6 changes: 0 additions & 6 deletions CodeNav.Nunit/Files/TestEmptyClass.cs

This file was deleted.

7 changes: 0 additions & 7 deletions CodeNav.Nunit/Files/TestNestedNamespaces.cs

This file was deleted.

20 changes: 0 additions & 20 deletions CodeNav.Nunit/Files/TestProperties.cs

This file was deleted.

27 changes: 0 additions & 27 deletions CodeNav.Nunit/Files/TestSealed.cs

This file was deleted.

36 changes: 0 additions & 36 deletions CodeNav.Nunit/Properties/AssemblyInfo.cs

This file was deleted.

15 changes: 0 additions & 15 deletions CodeNav.Nunit/app.config

This file was deleted.

5 changes: 0 additions & 5 deletions CodeNav.Nunit/packages.config

This file was deleted.

57 changes: 25 additions & 32 deletions CodeNav.Tests/CodeNav.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.props')" />
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1CD28428-D510-4731-B549-E93424398D0F}</ProjectGuid>
<ProjectGuid>{3FF290DC-DCE3-4B6C-B3B9-0CE6B995E908}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeNav.Tests</RootNamespace>
<AssemblyName>CodeNav.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -41,28 +33,38 @@
<Reference Include="Caliburn.Micro, Version=3.0.3.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.3.0.3\lib\net45\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.0.8-rc2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.0.8-rc2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Files\CodeNavTest.cs" />
<Compile Include="Files\TestEmptyInterface.cs" />
<Compile Include="Files\TestEmptyClass.cs" />
<Compile Include="Files\TestInterface.cs" />
<Compile Include="Files\TestNestedNamespaces.cs" />
<Compile Include="Files\TestNoNamespace.cs" />
<Compile Include="Files\TestProperties.cs" />
<Compile Include="Files\TestSealed.cs" />
<Compile Include="Files\TestEmptyClass.cs" />
<Compile Include="Files\TestNestedNamespaces.cs" />
<Compile Include="TestInterface.cs" />
<Compile Include="TestProperties.cs" />
<Compile Include="TestSealed.cs" />
<Compile Include="TestEmptyClass.cs" />
<Compile Include="TestNestedNamespaces.cs" />
<Compile Include="Files\TestUsingsInNamespace.cs" />
<Compile Include="MapperTests\TestEmptyInterface.cs" />
<Compile Include="MapperTests\TestUsingsInNamespace.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MapperTests\TestEmptyClass.cs" />
<Compile Include="MapperTests\TestInterface.cs" />
<Compile Include="MapperTests\TestNoNamespace.cs" />
<Compile Include="MapperTests\TestNestedNamespaces.cs" />
<Compile Include="MapperTests\TestProperties.cs" />
<Compile Include="MapperTests\TestSealed.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Expand All @@ -74,14 +76,5 @@
<Name>CodeNav</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.10-rc2\build\net45\MSTest.TestAdapter.targets')" />
</Project>
File renamed without changes.
4 changes: 4 additions & 0 deletions CodeNav.Tests/Files/TestEmptyInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace CodeNav.Tests.Files
{

}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace CodeNav.Tests
namespace CodeNav.Tests.Files
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using CodeNav.Models;
using NUnit.Framework;

namespace CodeNav.Tests
namespace CodeNav.Tests.MapperTests
{
[TestFixture]
public class TestEmptyClass
Expand Down
28 changes: 28 additions & 0 deletions CodeNav.Tests/MapperTests/TestEmptyInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.IO;
using System.Linq;
using System.Windows;
using CodeNav.Mappers;
using CodeNav.Models;
using NUnit.Framework;

namespace CodeNav.Tests.MapperTests
{
[TestFixture]
public class TestEmptyInterface
{
[Test]
public void ShouldBeOk()
{
var document = SyntaxMapper.MapDocument(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\TestEmptyInterface.cs"));

Assert.IsTrue(document.Any());

// First item should be a namespace
Assert.AreEqual(CodeItemKindEnum.Namespace, document.First().Kind);

// Namespace item should not have members
Assert.IsTrue(!(document.First() as IMembers).Members.Any());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using CodeNav.Models;
using NUnit.Framework;

namespace CodeNav.Tests
namespace CodeNav.Tests.MapperTests
{
[TestFixture]
public class TestInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using CodeNav.Models;
using NUnit.Framework;

namespace CodeNav.Tests
namespace CodeNav.Tests.MapperTests
{
[TestFixture]
public class TestNestedNamespaces
Expand Down
24 changes: 24 additions & 0 deletions CodeNav.Tests/MapperTests/TestNoNamespace.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.IO;
using System.Linq;
using CodeNav.Mappers;
using CodeNav.Models;
using NUnit.Framework;

namespace CodeNav.Tests.MapperTests
{
[TestFixture]
public class TestNoNamespace
{
[Test]
public void ShouldHaveCorrectStructure()
{
var document = SyntaxMapper.MapDocument(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\Files\\TestNoNamespace.cs"));

Assert.IsTrue(document.Any());

// First item should be a class
Assert.AreEqual(CodeItemKindEnum.Class, document.First().Kind);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using CodeNav.Models;
using NUnit.Framework;

namespace CodeNav.Tests
namespace CodeNav.Tests.MapperTests
{
[TestFixture]
public class TestProperties
Expand Down
Loading

0 comments on commit a695244

Please sign in to comment.