testtttt
continuous-integration/drone/push Build is passing Details

test_old_branch
Jérémy Mouyon 12 months ago
parent 4bdc3eeb5d
commit 3ffe1c4821

@ -21,4 +21,52 @@ public class TestCell
Assert.Equal(x, c.GetX); Assert.Equal(x, c.GetX);
Assert.Equal(y, c.GetY); Assert.Equal(y, c.GetY);
} }
public static IEnumerable<object[]> Data_Cell()
{
yield return new object[]
{
true,
new Cell(0,0),
new Tile(Shape.Round, Color.Red)
};
yield return new object[]
{
false,
new Cell(0,0),
new Tile(Shape.Round, Color.Red)
};
}
[Theory]
[MemberData(nameof(Data_Cell))]
public void Test_CellSetTile(bool except, Cell c, Tile t)
{
if (!except)
{
c.SetTile(t);
Assert.False(c.SetTile(t));
return;
}
Assert.True(c.SetTile(t));
}
[Theory]
[MemberData(nameof(Data_Cell))]
public void Test_IsFree(bool except, Cell c, Tile t)
{
if (except == false)
{
c.SetTile(t);
Assert.False(c.IsFree);
return;
}
Assert.True(c.IsFree);
}
} }

@ -1,56 +1,46 @@
// using QwirkleClassLibrary; using QwirkleClassLibrary;
// using System; using System;
// using System.Collections.Generic; using System.Collections.Generic;
// using System.Linq; using System.Linq;
// using System.Text; using System.Text;
// using System.Threading.Tasks; using System.Threading.Tasks;
//
// namespace TestBase namespace TestBase
// { {
// internal class TestTile public class TestTile
// { {
// public class TestCorrect // test with correct Shape and Color [Fact]
// { public void TestCreateCorrect()
// [Fact] {
// public void TestCreateCorrect() Tile t = new Tile(Shape.Star, Color.Blue);
// { Assert.NotNull(t);
// Tile t = new Tile(Shape.Star, Color.Blue); Assert.Equal(Shape.Star, t.GetShape);
// Assert.NotNull(t); Assert.Equal(Color.Blue, t.GetColor);
// Assert.Equal(Shape.Star, t.GetShape); }
// Assert.Equal(Color.Blue, t.GetColor); public static IEnumerable<object[]> Data_Tile()
// } {
// // Modifier plus tard avec [Theory] à la place de [Fact] pour tester avec toutes les Shape et Color possibles (voir vidéo) yield return new object[]
// } {
// new Tile(Shape.Round, Color.Green)
// public class TestWrongColor // test with correct Shape but wrong Color };
// { yield return new object[]
// [Fact] {
// public void TestCreateWrongColor() new Tile(Shape.Shuriken, Color.Red)
// { };
// Tile t = new Tile(Shape.Rhombus, Color.Red); }
// Assert.Fail(t);
// } [Theory]
// } [MemberData(nameof(Data_Tile))]
// public class TestWrongShape // test with wrong Shape but correct Color public void Test_Name(Tile t)
// { {
// [Fact] Shape s = t.GetShape;
// public void TestCreateWrongShape() Color c = t.GetColor;
// { string str = (c.ToString() + s.ToString());
// bool result = new Tile(Shape.Star, Color.Green); Assert.Equal(t.NameColorTile(), str);
// Assert.False(result); }
// }
// } }
//
// public class TestWrongShapeWrongColor // test with wrong Sape and wrong Color
// { }
// [Fact]
// public void TestCreateWrongShapeWrongColor()
// {
// bool result = new Tile(Shape.Rhombus, Color.Blue);
// Assert.False(result);
// }
// }
//
// }
// }
//

Loading…
Cancel
Save