| | 1 | | using NSubstitute; |
| | 2 | | using NUnit.Framework; |
| | 3 | |
|
| | 4 | | namespace Tests.BuildModeHUDControllers |
| | 5 | | { |
| | 6 | | public class PublishPopupControllerShould |
| | 7 | | { |
| | 8 | | private PublishPopupController publishPopupController; |
| | 9 | |
|
| | 10 | | [SetUp] |
| | 11 | | public void SetUp() |
| | 12 | | { |
| 4 | 13 | | publishPopupController = new PublishPopupController(); |
| 4 | 14 | | publishPopupController.Initialize(Substitute.For<IPublishPopupView>()); |
| 4 | 15 | | } |
| | 16 | |
|
| | 17 | | [TearDown] |
| 8 | 18 | | public void TearDown() { publishPopupController.Dispose(); } |
| | 19 | |
|
| | 20 | | [Test] |
| | 21 | | public void PublishStartCorrectly() |
| | 22 | | { |
| | 23 | | // Act |
| 1 | 24 | | publishPopupController.PublishStart(); |
| | 25 | |
|
| | 26 | | // Assert |
| 1 | 27 | | publishPopupController.publishPopupView.Received(1).PublishStart(); |
| 1 | 28 | | publishPopupController.publishPopupView.Received(1).SetPercentage(0f); |
| 1 | 29 | | } |
| | 30 | |
|
| | 31 | | [Test] |
| | 32 | | [TestCase(true)] |
| | 33 | | [TestCase(false)] |
| | 34 | | public void PublishEndCorrectly(bool isOk) |
| | 35 | | { |
| | 36 | | // Arrange |
| 2 | 37 | | string testErrorMesssage = "Test error"; |
| | 38 | |
|
| | 39 | | // Act |
| 2 | 40 | | publishPopupController.PublishEnd(isOk, testErrorMesssage); |
| | 41 | |
|
| | 42 | | // Assert |
| 2 | 43 | | publishPopupController.publishPopupView.Received(1).PublishEnd(isOk, testErrorMesssage); |
| 2 | 44 | | } |
| | 45 | |
|
| | 46 | | [Test] |
| | 47 | | public void SetPercentageCorrectly() |
| | 48 | | { |
| | 49 | | // Arrange |
| 1 | 50 | | float testPercentage = 16.8f; |
| | 51 | |
|
| | 52 | | // Act |
| 1 | 53 | | publishPopupController.SetPercentage(testPercentage); |
| | 54 | |
|
| | 55 | | // Assert |
| 1 | 56 | | publishPopupController.publishPopupView.Received(1).SetPercentage(testPercentage); |
| 1 | 57 | | } |
| | 58 | | } |
| | 59 | | } |