Exemple #1
0
        public void ReleasingUnlockedDataFileIsInvalid()
        {
            var sut             = new UnlockedDataFile("201306158F341A2D6FD7416B87073A0132DD51AE.chk");
            var messageBodyMock = new Mock <MessageBody>(sut);

            Assert.That(
                () => sut.Release(messageBodyMock.Object),
                Throws.InvalidOperationException);
        }
Exemple #2
0
        public void LockRenamesLocalDataFile()
        {
            var servantMock = new Mock <DataFileServant>();

            DataFileServant.Instance = servantMock.Object;

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

            servantMock.Setup(s => s.TryMoveFile(filePath, It.Is <string>(path => path.Tokenize().State == LockedDataFile.STATE_TOKEN))).Returns(true).Verifiable();

            sut.Lock(messageBodyMock.Object);

            servantMock.VerifyAll();
        }
Exemple #3
0
        public void LockTransitionsToLockedDataFileWhenOperationSucceeds()
        {
            var servantMock = new Mock <DataFileServant>();

            DataFileServant.Instance = servantMock.Object;

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

            messageBodyMock.SetupAllProperties();

            servantMock.Setup(s => s.TryMoveFile(filePath, It.Is <string>(path => path.Tokenize().State == LockedDataFile.STATE_TOKEN))).Returns(true);

            sut.Lock(messageBodyMock.Object);

            Assert.That(messageBodyMock.Object.DataFile, Is.TypeOf <LockedDataFile>());
        }