public void UnlockTransitionsToAwaitingRetryDataFileWhenOperationFails()
        {
            var servantMock = new Mock <DataFileServant>();

            DataFileServant.Instance = servantMock.Object;

            const string filePath        = "201306158F341A2D6FD7416B87073A0132DD51AE.chk.20150627111406.released";
            var          sut             = new ReleasedDataFile(filePath);
            var          messageBodyMock = new Mock <MessageBody>(sut);

            servantMock.Setup(s => s.TryDeleteFile(filePath)).Returns(false);

            sut.Unlock(messageBodyMock.Object);

            messageBodyMock.Object.DataFile.Should().BeOfType <AwaitingRetryDataFile>();
        }
        public void UnlockDeletesLocalDataFile()
        {
            var servantMock = new Mock <DataFileServant>();

            DataFileServant.Instance = servantMock.Object;

            const string filePath        = "201306158F341A2D6FD7416B87073A0132DD51AE.chk.20150627111406.released";
            var          sut             = new ReleasedDataFile(filePath);
            var          messageBodyMock = new Mock <MessageBody>(sut);

            servantMock.Setup(s => s.TryDeleteFile(filePath)).Returns(true).Verifiable();

            sut.Unlock(messageBodyMock.Object);

            servantMock.VerifyAll();
        }
        public void UnlockDoesNotTransitionToNewStateWhenOperationSucceeds()
        {
            var servantMock = new Mock <DataFileServant>();

            DataFileServant.Instance = servantMock.Object;

            const string filePath        = "201306158F341A2D6FD7416B87073A0132DD51AE.chk.20150627111406.released";
            var          sut             = new ReleasedDataFile(filePath);
            var          messageBodyMock = new Mock <MessageBody>(sut);

            servantMock.Setup(s => s.TryDeleteFile(filePath)).Returns(true);

            sut.Unlock(messageBodyMock.Object);

            messageBodyMock.Object.DataFile.Should().BeSameAs(sut);
        }