public async Task Integration_BasicItemSync() { Library client1 = new Library("machine1", SQLiteHelpers.CreateInMemoryDb(), _serverCaller, Logger.None); Library client2 = new Library("machine2", SQLiteHelpers.CreateInMemoryDb(), _serverCaller, Logger.None); // create item on server, pull to 1 await _serverCaller.CreateNewLibraryItemAsync("foo/bar.mp3"); await client1.PullFromServer(); // modify item to generate a bunch of events LibraryItem item = client1.Items.Single(); item.IncrementPlayCount(); item.IncrementPlayCount(); item.Name = "GIMIX set"; item.FilePath = "bar.mp3"; item.Artist = "The Avalanches"; item.Album = "Mixes"; item.AddBookmark(TimeSpan.FromSeconds(30)); item.AddBookmark(TimeSpan.FromSeconds(40)); // sync from 1 to 2 await client1.PushToServer(); await client2.PullFromServer(); AssertLibrariesHaveSameItems(client1, client2); // Delete a bookmark client2.Items.Single().Bookmarks.Count.Should().Be(2); client2.Items.Single().DeleteBookmark(item.Bookmarks.First().ID); client2.Items.Single().Bookmarks.Count.Should().Be(1); // Set bookmark emoji LibraryItem client2Item = client2.Items.Single(); Bookmark remainingBookmark = client2Item.Bookmarks.Single(); client2.Items.Single().SetBookmarkEmoji(remainingBookmark.ID, "🎶"); client2.Items.Single().Bookmarks.Single().Emoji.Should().Be("🎶"); client2.Items.Single().IncrementPlayCount(); await client2.PushToServer(); await client1.PullFromServer(); AssertLibrariesHaveSameItems(client1, client2); // delete and make sure the delete propagates client1.Delete(client1.Items.Single()); client1.Items.Count.Should().Be(0); await client1.PushToServer(); await client2.PullFromServer(); AssertLibrariesHaveSameItems(client1, client2); }