public async Task <bool> CommitFailsToCloseStreamDueToException()
        {
            MockFileStreamer
            .Setup(x => x.CloseStream(It.IsAny <string>()))
            .Throws <Exception>();
            var result = await FileDataWorker.Commit <BasicData>(ExpectedBasicData.Id);

            MockFileStreamer
            .Verify(x => x.CloseStream(It.IsAny <string>()), Times.Once);
            MockFileStreamer
            .Verify(x => x.DisposeOfStream("Data\\BasicData\\" + ExpectedBasicData.Id + ".data"), Times.Once);
            MockFileStreamer
            .Verify(x => x.UnlockFile("Data\\BasicData\\" + ExpectedBasicData.Id + ".data"), Times.Once);
            return(result);
        }
        public async Task <bool> CommitSuccessful()
        {
            MockFileStreamer
            .Setup(x => x.CloseStream(It.IsAny <string>()))
            .ReturnsAsync(true);
            var result = await FileDataWorker.Commit <BasicData>(ExpectedBasicData.Id);

            MockFileStreamer
            .Verify(x => x.CloseStream("Data\\BasicData\\" + ExpectedBasicData.Id + ".data"), Times.Once);
            MockFileStreamer
            .Verify(x => x.DisposeOfStream("Data\\BasicData\\" + ExpectedBasicData.Id + ".data"), Times.Never);
            MockFileStreamer
            .Verify(x => x.UnlockFile("Data\\BasicData\\" + ExpectedBasicData.Id + ".data"), Times.Once);
            return(result);
        }
        public async Task <bool> CommitFailsToCloseStreamWithRetry()
        {
            MockFileStreamer
            .Setup(x => x.CloseStream(It.IsAny <string>()))
            .ReturnsAsync(false);
            var result = await FileDataWorker.Commit <RetryBasicData>(ExpectedRetryBasicData.Id);

            MockFileStreamer
            .Verify(x => x.CloseStream(It.IsAny <string>()), Times.Exactly(3));
            MockFileStreamer
            .Verify(x => x.DisposeOfStream("Data\\RetryBasicData\\" + ExpectedRetryBasicData.Id + ".data"),
                    Times.Once);
            MockFileStreamer
            .Verify(x => x.UnlockFile("Data\\RetryBasicData\\" + ExpectedRetryBasicData.Id + ".data"), Times.Once);
            return(result);
        }