public void UpdateService_Creation_ShouldThrowException_IfPinpadCommunicationIsNull() { // Assert Assert.Throws <ArgumentNullException>(() => { // Arrange IPinpadInfos infos = new Stubs.PinpadInfosStub(); IPinpadCommunication comm = null; // Act and assert PinpadUpdateService pinpadUpdateService = new PinpadUpdateService( infos, comm); }); }
public void UpdateService_Update_ShouldThrowException_IfTheLoadMethodWasCalledButUnsucessful() { // Assert Assert.Throws <InvalidOperationException>(() => { // Arrange IPinpadInfos infos = new Stubs.PinpadInfosStub(); IPinpadCommunication comm = new Stubs.PinpadCommunicationStub(); PinpadUpdateService pinpadUpdateService = new PinpadUpdateService(infos, comm); string nonExistingApplicationPath = Path.Combine(Directory.GetCurrentDirectory(), "NotExistingApp.1.2.3.zip"); // Act and assert pinpadUpdateService.Load(nonExistingApplicationPath); pinpadUpdateService.Update(); }); }
public void UpdateService_Update_ShouldThrowException_IfLoadMethodWasNotPreviouslyCalled() { // Assert Assert.Throws <InvalidOperationException>(() => { // Arrange IPinpadInfos infos = new Stubs.PinpadInfosStub(); IPinpadCommunication comm = new Stubs.PinpadCommunicationStub(); PinpadUpdateService pinpadUpdateService = new PinpadUpdateService( infos, comm); // Act pinpadUpdateService.Update(); }); }
public void UpdateService_Load_ShouldReturnFalse_IfZippedApplicationFileDoesNotExist() { // Arrange IPinpadInfos infos = new Stubs.PinpadInfosStub(); IPinpadCommunication comm = new Stubs.PinpadCommunicationStub(); PinpadUpdateService pinpadUpdateService = new PinpadUpdateService( infos, comm); string nonExistingApplicationPath = Path.Combine( Directory.GetCurrentDirectory(), "NotExistingApp.1.2.3.zip"); // Act bool result = pinpadUpdateService.Load(nonExistingApplicationPath); // Assert Assert.IsFalse(result); }
public void UpdateService_Load_ShouldReturnTrue_IfTheZippedApplicationFileExists() { // Arrange IPinpadInfos infos = new Stubs.PinpadInfosStub(); IPinpadCommunication comm = new Stubs.PinpadCommunicationStub(); PinpadUpdateService pinpadUpdateService = new PinpadUpdateService( infos, comm); string applicationPath = Path.Combine( AppDomain.CurrentDomain.BaseDirectory, UpdateServiceTest.MockedApplicationName); // Act bool result = pinpadUpdateService.Load(applicationPath); // Assert Assert.IsTrue(result); }
public void UpdateService_Update_ShouldReturnFalse_IfThePinpadIsNotFromStone() { // Arrange IPinpadInfos infos = new Stubs.PinpadInfosStub(false); IPinpadCommunication comm = new Stubs.PinpadCommunicationStub(); PinpadUpdateService pinpadUpdateService = new PinpadUpdateService( infos, comm); string applicationPath = Path.Combine( Directory.GetCurrentDirectory(), UpdateServiceTest.MockedApplicationName); pinpadUpdateService.Load(applicationPath); // Act bool result = pinpadUpdateService.Update(); // Assert Assert.IsFalse(result); }