mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-12 04:06:36 +08:00
项目结构调整
This commit is contained in:
105
Others/Dragablz/Dragablz.Test/Core/CollectionTeaserFixtures.cs
Normal file
105
Others/Dragablz/Dragablz.Test/Core/CollectionTeaserFixtures.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using FakeItEasy;
|
||||
|
||||
namespace Dragablz.Core.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CollectionTeaserFixture
|
||||
{
|
||||
[Test]
|
||||
public void WillCreateForList()
|
||||
{
|
||||
var myList = new ArrayList();
|
||||
|
||||
CollectionTeaser collectionTeaser;
|
||||
var result = CollectionTeaser.TryCreate(myList, out collectionTeaser);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
Assert.IsNotNull(collectionTeaser);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillCreateForGenericCollection()
|
||||
{
|
||||
var myList = A.Fake<ICollection<string>>();
|
||||
|
||||
CollectionTeaser collectionTeaser;
|
||||
var result = CollectionTeaser.TryCreate(myList, out collectionTeaser);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
Assert.IsNotNull(collectionTeaser);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillCreateForCollection()
|
||||
{
|
||||
var myList = A.Fake<ICollection>();
|
||||
|
||||
CollectionTeaser collectionTeaser;
|
||||
var result = CollectionTeaser.TryCreate(myList, out collectionTeaser);
|
||||
|
||||
Assert.IsFalse(result);
|
||||
Assert.IsNull(collectionTeaser);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillAddForList()
|
||||
{
|
||||
var myList = new ArrayList();
|
||||
CollectionTeaser collectionTeaser;
|
||||
Assert.IsTrue(CollectionTeaser.TryCreate(myList, out collectionTeaser));
|
||||
|
||||
collectionTeaser.Add("i am going to type this in, manually, twice.");
|
||||
|
||||
CollectionAssert.AreEquivalent(new[] { "i am going to type this in, manually, twice." }, myList);
|
||||
//i didnt really. i copied and pasted it.
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillRemoveForList()
|
||||
{
|
||||
var myList = new ArrayList
|
||||
{
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
};
|
||||
CollectionTeaser collectionTeaser;
|
||||
Assert.IsTrue(CollectionTeaser.TryCreate(myList, out collectionTeaser));
|
||||
|
||||
collectionTeaser.Remove(3);
|
||||
|
||||
CollectionAssert.AreEquivalent(new[] { 1, 2, 4, 5 }, myList);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillAddForGenericCollection()
|
||||
{
|
||||
var myList = A.Fake<ICollection<string>>();
|
||||
CollectionTeaser collectionTeaser;
|
||||
Assert.IsTrue(CollectionTeaser.TryCreate(myList, out collectionTeaser));
|
||||
|
||||
collectionTeaser.Add("hello");
|
||||
|
||||
A.CallTo(() => myList.Add("hello")).MustHaveHappened();
|
||||
A.CallTo(() => myList.Remove("hello")).MustNotHaveHappened();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WillRemoveForGenericCollection()
|
||||
{
|
||||
var myList = A.Fake<ICollection<string>>();
|
||||
CollectionTeaser collectionTeaser;
|
||||
Assert.IsTrue(CollectionTeaser.TryCreate(myList, out collectionTeaser));
|
||||
|
||||
collectionTeaser.Remove("bye");
|
||||
|
||||
A.CallTo(() => myList.Remove("bye")).MustHaveHappened();
|
||||
A.CallTo(() => myList.Add("bye")).MustNotHaveHappened();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using NUnit.Framework;
|
||||
namespace Dragablz.Dockablz.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TilerCalculatorFixture
|
||||
{
|
||||
[TestCase(0, new int[0])]
|
||||
[TestCase(1, new[] { 1 })]
|
||||
[TestCase(2, new[] { 1, 1 })]
|
||||
[TestCase(3, new[] { 1, 2 })]
|
||||
[TestCase(4, new[] { 2, 2 })]
|
||||
[TestCase(5, new[] { 2, 3 })]
|
||||
[TestCase(6, new[] { 3, 3 })]
|
||||
[TestCase(7, new[] { 2, 2, 3 })]
|
||||
[TestCase(9, new[] { 3, 3, 3 })]
|
||||
[TestCase(10, new[] { 3, 3, 4 })]
|
||||
[TestCase(25, new[] { 5, 5, 5, 5, 5 })]
|
||||
[TestCase(26, new[] { 5, 5, 5, 5, 6 })]
|
||||
[TestCase(29, new[] { 5, 6, 6, 6, 6 })]
|
||||
[TestCase(30, new[] { 6, 6, 6, 6, 6 })]
|
||||
public void WillCalculateCellsPerColumn(int totalCells, int[] expectedCellsPerColumn)
|
||||
{
|
||||
var result = TilerCalculator.GetCellCountPerColumn(totalCells);
|
||||
|
||||
CollectionAssert.AreEqual(expectedCellsPerColumn, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Others/Dragablz/Dragablz.Test/Dragablz.Test.csproj
Normal file
24
Others/Dragablz/Dragablz.Test/Dragablz.Test.csproj
Normal file
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp3.0;net45;net40</TargetFrameworks>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="1.1.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FakeItEasy" Version="5.4.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dragablz\Dragablz.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user