public void SerializedResourceLibraryRoundtrip()
        {
            var expected         = Guid.NewGuid().ToString();
            var expectedResource = new GenericNativeResource <string>(expected);
            var resourceUri      = ResourcesHelper.NewTestResourceUri(expectedResource.Id);

            ResourceManager.RegisterResourceLoader(ResourcesHelper.TestResourceLoader <string>(id => expectedResource));

            var library  = new ResourceLibrary();
            var resource = library.GetResourceByUri <GenericNativeResource <string> >(resourceUri);

            Assert.IsNotNull(resource);
            Assert.AreEqual(expected, resource.NativeResource);

            var libraryXml = Encoding.UTF8.GetString(library.ToBytes());

            Assert.IsFalse(string.IsNullOrEmpty(libraryXml));

            var savedLibrary = ResourceLibrary.FromBytes(Encoding.UTF8.GetBytes(libraryXml));

            Assert.IsNotNull(savedLibrary);

            var resourceById  = savedLibrary.GetResource <GenericNativeResource <string> >(expectedResource.Id);
            var resourceByUri = savedLibrary.GetResourceByUri <GenericNativeResource <string> >(resourceUri);

            Assert.AreSame(resourceById, resourceByUri);
            Assert.AreEqual(expected, resourceById.NativeResource);
        }