BloomTests.WebLibraryIntegration.BookTransferTests.UploadBook_SameId_Replaces C# (CSharp) Method

UploadBook_SameId_Replaces() private method

private UploadBook_SameId_Replaces ( ) : void
return void
        public void UploadBook_SameId_Replaces()
        {
            var bookFolder = MakeBook("unittest", "myId", "me", "something");
            var jsonPath = bookFolder.CombineForPath(BookInfo.MetaDataFileName);
            var json = File.ReadAllText(jsonPath);
            var jsonStart = json.Substring(0, json.Length - 1);
            var newJson = jsonStart + ",\"bookLineage\":\"original\"}";
            File.WriteAllText(jsonPath, newJson);
            Login();
            string s3Id = _transfer.UploadBook(bookFolder, new NullProgress());
            File.Delete(bookFolder.CombineForPath("one.css"));
            File.WriteAllText(Path.Combine(bookFolder, "one.htm"), "something new");
            File.WriteAllText(Path.Combine(bookFolder, "two.css"), @"test");
            // Tweak the json, but don't change the ID.
            newJson = jsonStart + ",\"bookLineage\":\"other\"}";
            File.WriteAllText(jsonPath, newJson);

            _transfer.UploadBook(bookFolder, new NullProgress());

            var dest = _workFolderPath.CombineForPath("output");
            Directory.CreateDirectory(dest);
            var newBookFolder = _transfer.DownloadBook(BloomS3Client.UnitTestBucketName, s3Id, dest);

            var firstData = File.ReadAllText(newBookFolder.CombineForPath("one.htm"));
            Assert.That(firstData, Is.StringContaining("something new"), "We should have overwritten the changed file");
            Assert.That(File.Exists(newBookFolder.CombineForPath("two.css")), Is.True, "We should have added the new file");
            Assert.That(File.Exists(newBookFolder.CombineForPath("one.css")), Is.False, "We should have deleted the obsolete file");
            // Verify that metadata was overwritten, new record not created.
            // This part of the test currently fails. New data is not showing up in parse.com unit test application soon enough.
            //var records = _parseClient.GetBookRecords("myId");
            //Assert.That(records.Count, Is.EqualTo(1), "Should have overwritten parse.com record, not added or deleted");
            //Assert.That(records[0].bookLineage.Value, Is.EqualTo("other"));
        }