public void LoadProjectSnapshotLoadsExistingSnapshot()
        {
            // Arrange
            var logFile        = "log20100101120000Lbuild.1.0";
            var snapshotsDir   = Path.Combine("workingDir", defaultFolder);
            var snapshotFile   = Path.Combine(snapshotsDir, logFile + ".snapshot");
            var outputStream   = new MemoryStream();
            var fileSystemMock = InitialiseFileSystemMockForInput(snapshotFile, defaultJson);
            var projectMock    = InitialiseProjectMock("workingDir");
            var dataStore      = new JsonFolderDataStore
            {
                FileSystem = fileSystemMock
            };

            this.mocks.ReplayAll();

            // Act
            var snapshot = dataStore.LoadProjectSnapshot(projectMock, logFile + ".xml");

            // Assert
            this.mocks.VerifyAll();
            Assert.IsNotNull(snapshot);
            Assert.AreEqual("TestProject", snapshot.Name);
            Assert.AreEqual(
                DateTime.Parse("2010-01-01T12:00:00.00000+00:00", CultureInfo.InvariantCulture).ToUniversalTime(),
                snapshot.TimeStarted);
            Assert.AreEqual(ItemBuildStatus.CompletedSuccess, snapshot.Status);
        }
        public void LoadProjectSnapshotReturnsNullForMissingSnapshot()
        {
            // Arrange
            var logFile        = "log20100101120000Lbuild.1.0";
            var snapshotsDir   = Path.Combine("workingDir", defaultFolder);
            var snapshotFile   = Path.Combine(snapshotsDir, logFile + ".snapshot");
            var outputStream   = new MemoryStream();
            var fileSystemMock = InitialiseFileSystemMockForInput(snapshotFile, null);
            var projectMock    = InitialiseProjectMock("workingDir");
            var dataStore      = new JsonFolderDataStore
            {
                FileSystem = fileSystemMock
            };

            this.mocks.ReplayAll();

            // Act
            var snapshot = dataStore.LoadProjectSnapshot(projectMock, logFile + ".xml");

            // Assert
            this.mocks.VerifyAll();
            Assert.IsNull(snapshot);
        }