Skip to content

Commit 8e82b33

Browse files
author
242440 Adam Kruszynski
committed
Stage 1 Final
1 parent 2ed1d0e commit 8e82b33

13 files changed

Lines changed: 41 additions & 6 deletions

File tree

Logic/bin/Debug/net6.0/Logic.dll

0 Bytes
Binary file not shown.

Logic/bin/Debug/net6.0/Logic.pdb

-52 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-52 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-56 Bytes
Binary file not shown.

TestProject/BallTest.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,36 @@ public class BallTest
99

1010
{
1111
[TestMethod]
12-
public void BallTests()
12+
public void CreateBallTest()
1313
{
1414
IBallsManager _ballsManager = new BallsManager();
1515
_ballsManager.CreateNewBall(10, 10, 25);
1616
//czy kula prawid³owo powstaje
1717
Assert.AreEqual(_ballsManager.GetBall(0).X, 10);
1818
Assert.AreEqual(_ballsManager.GetBall(0).Y, 10);
1919
Assert.AreEqual(_ballsManager.GetBall(0).Radius, 25);
20+
}
21+
22+
[TestMethod]
23+
public void UpdateBallTest()
24+
{
25+
IBallsManager _ballsManager = new BallsManager();
26+
_ballsManager.CreateNewBall(10, 10, 25);
2027
//czy zmiana miejsca kuli dzia³a prawid³owo
21-
_ballsManager.UpdateBallStatus(0, 20, 30);
28+
_ballsManager.UpdateBallStatus(0, 20, 30);
2229
Assert.AreEqual(_ballsManager.GetBall(0).X, 20);
2330
Assert.AreEqual(_ballsManager.GetBall(0).Y, 30);
31+
}
2432

33+
[TestMethod]
34+
public void RandomBallsTest()
35+
{
36+
IBallsManager _ballsManager = new BallsManager();
2537
Random random = new Random();
2638
_ballsManager.CreateNewBall(random.Next(1127) + 25, random.Next(404) + 25, 25);
2739
//czy kula powstanie w prawid³owym obszarze(wymiary odpowiadaj¹ce scenie)
28-
Assert.IsTrue(_ballsManager.GetBall(1).X > 0 && _ballsManager.GetBall(1).X < 1190);
29-
Assert.IsTrue(_ballsManager.GetBall(1).Y > 0 && _ballsManager.GetBall(1).Y < 474);
30-
31-
40+
Assert.IsTrue(_ballsManager.GetBall(0).X > 0 && _ballsManager.GetBall(0).X < 1190);
41+
Assert.IsTrue(_ballsManager.GetBall(0).Y > 0 && _ballsManager.GetBall(0).Y < 474);
3242
}
3343
}
3444
}

TestProject/LogicTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Data;
2+
using Logic;
3+
using System;
4+
5+
namespace TestProject
6+
{
7+
[TestClass()]
8+
public class LogicTest
9+
10+
{
11+
[TestMethod]
12+
public void InitializeTest()
13+
{
14+
IBallsManager _ballsManager = new BallsManager();
15+
ILogic _logic = new Logic.Logic(_ballsManager);
16+
17+
_logic.Initialize(1190, 474, 5);
18+
for (int i = 0; i < 5; i++)
19+
{
20+
Assert.IsTrue(_logic.GetLocation(i).X > 0 && _logic.GetLocation(i).X < 1190);
21+
Assert.IsTrue(_logic.GetLocation(i).Y > 0 && _logic.GetLocation(i).Y < 474);
22+
}
23+
}
24+
}
25+
}
-164 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)