no? maybe now?

This commit is contained in:
Kwoth 2016-10-22 17:02:15 +02:00
parent 767fc1d35c
commit 4db44afa0c
3 changed files with 0 additions and 158 deletions

View File

@ -1,107 +0,0 @@
using NadekoBot.Modules.Permissions;
using NadekoBot.Services.Database.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace Tests
{
public class Tests
{
private Permission GetRoot()
{
Permission root = new Permission();
root.SecondaryTargetName = "Root";
var cur = root;
for (var i = 1; i < 10; i++)
{
var p = new Permission();
p.SecondaryTargetName = i.ToString();
p.Previous = cur;
cur.Next = p;
cur = p;
}
return root;
}
[Fact]
public void CountTest()
{
var root = GetRoot();
Assert.Equal(10, root.Count());
}
[Fact]
public void AddTest()
{
var root = GetRoot();
root.Prepend(new Permission() { SecondaryTargetName = "Added" });
root = root.GetRoot();
Assert.Equal(11, root.Count());
Assert.Equal("Added", root.AsEnumerable().First().SecondaryTargetName);
}
[Fact]
public void GetAtTest()
{
var root = GetRoot();
Assert.Equal("Root", root.GetAt(0).SecondaryTargetName);
Assert.Equal("1", root.GetAt(1).SecondaryTargetName);
Assert.Equal("5", root.GetAt(5).SecondaryTargetName);
Assert.Equal("9", root.GetAt(9).SecondaryTargetName);
Assert.Throws(typeof(IndexOutOfRangeException), () => { root.GetAt(-5); });
Assert.Throws(typeof(IndexOutOfRangeException), () => { root.GetAt(10); });
}
//[Fact]
//public void InsertTest() {
// var root = GetRoot();
// root.Insert(5, new Permission() { SecondaryTargetName = "in2" });
// Assert.Equal(11, root.Count());
// Assert.Equal("in2", root.GetAt(5).SecondaryTargetName);
// root.Insert(0, new Permission() { SecondaryTargetName = "Inserted" });
// root = root.Previous;
// Assert.Equal("Inserted", root.SecondaryTargetName);
// Assert.Equal(12, root.Count());
// Assert.Equal("Root", root.GetAt(1).SecondaryTargetName);
// Assert.Throws(typeof(IndexOutOfRangeException), () => { root.GetAt(12); });
//}
[Fact]
public void RemoveAtTest()
{
var root = GetRoot();
var removed = root.RemoveAt(3);
Assert.Equal("3", removed.SecondaryTargetName);
Assert.Equal(9, root.Count());
Assert.Throws(typeof(IndexOutOfRangeException), () => { root.RemoveAt(0); });
Assert.Throws(typeof(IndexOutOfRangeException), () => { root.RemoveAt(9); });
Assert.Throws(typeof(IndexOutOfRangeException), () => { root.RemoveAt(-1); });
}
[Fact]
public void TestGetRoot()
{
var root = GetRoot();
var random = root.GetAt(5).GetRoot();
Assert.Equal("Root", random.SecondaryTargetName);
}
}
}

View File

@ -1,30 +0,0 @@
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {
"System.Runtime.Serialization.Primitives": "4.1.1",
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-192208-24",
"NadekoBot": "1.0.0-*"
},
"testRunner": "xunit",
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": [
"dotnet5.4",
"portable-net451+win8"
]
}
},
"configurations": {
"GlobalNadeko": {}
}
}

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>14cbada0-971c-44e3-b331-c7d01dd74f0b</ProjectGuid>
<RootNamespace>tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>