context: using System;
  using System.Security.Cryptography;
  using NUnit.Framework;
  using TagLib.Ogg;
  
  namespace TagLib.Tests.TaggingFormats
  {   
  	[TestFixture]
  	public class OggTest
  	{
  		private static string val_sing =
  			"01234567890123456789012345678901234567890123456789";
  		private static string [] val_mult = new string [] {"A123456789",
  			"B123456789", "C123456789", "D123456789", "E123456789"};
  		private static string [] val_gnre = new string [] {"Rap",
  			"Jazz", "Non-Genre", "Blues"};
  		
  		[Test]
  		public void TestTitle ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.IsNull (t.Title, "Initial (Null): " + m);
  			});
  			
  			tag.Title = val_sing;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_sing, t.Title, "Value Set (!Null): " + m);
  			});
  			
  			tag.Title = string.Empty;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.IsNull (t.Title, "Value Cleared (Null): " + m);
  			});
  
  		}
  		
  		[Test]
  		public void TestPerformers ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Performers.Length, "Initial (Zero): " + m);
  			});
  			
  			tag.Performers = val_mult;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_mult.Length, t.Performers.Length, "Value Set: " + m);
  				for (int i = 0; i < val_mult.Length; i ++) {
  					Assert.AreEqual (val_mult [i], t.Performers [i], "Value Set: " + m);
  				}
  			});
  			
  			tag.Performers = new string [0];
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Performers.Length, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestAlbumArtists ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, t.AlbumArtists.Length, "Initial (Zero): " + m);
  			});
  			
  			tag.AlbumArtists = val_mult;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_mult.Length, t.AlbumArtists.Length, "Value Set: " + m);
  				for (int i = 0; i < val_mult.Length; i ++) {
  					Assert.AreEqual (val_mult [i], t.AlbumArtists [i], "Value Set: " + m);
  				}
  			});
  			
  			tag.AlbumArtists = new string [0];
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.AlbumArtists.Length, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestComposers ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Composers.Length, "Initial (Zero): " + m);
  			});
  			
  			tag.Composers = val_mult;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_mult.Length, t.Composers.Length, "Value Set: " + m);
  				for (int i = 0; i < val_mult.Length; i ++) {
  					Assert.AreEqual (val_mult [i], t.Composers [i], "Value Set: " + m);
  				}
  			});
  			
  			tag.Composers = new string [0];
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Composers.Length, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestAlbum ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.IsNull (t.Album, "Initial (Null): " + m);
  			});
  			
  			tag.Album = val_sing;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_sing, t.Album, "Value Set (!Null): " + m);
  			});
  			
  			tag.Album = string.Empty;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.IsNull (t.Album, "Value Cleared (Null): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestComment ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.IsNull (t.Comment, "Initial (Null): " + m);
  			});
  			
  			tag.Comment = val_sing;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_sing, t.Comment, "Value Set (!Null): " + m);
  			});
  			
  			tag.Comment = string.Empty;
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.IsNull (t.Comment, "Value Cleared (Null): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestGenres ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Genres.Length, "Initial (Zero): " + m);
  			});
  			
  			tag.Genres = val_gnre;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_gnre.Length, t.Genres.Length, "Value Set: " + m);
  				for (int i = 0; i < val_gnre.Length; i ++) {
  					Assert.AreEqual (val_gnre [i], t.Genres [i], "Value Set: " + m);
  				}
  			});
  			
  			tag.Genres = val_mult;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (val_mult.Length, t.Genres.Length, "Value Set: " + m);
  				for (int i = 0; i < val_mult.Length; i ++) {
  					Assert.AreEqual (val_mult [i], t.Genres [i], "Value Set: " + m);
  				}
  			});
  			
  			tag.Genres = new string [0];
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Genres.Length, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestYear ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, tag.Year, "Initial (Zero): " + m);
  			});
  			
  			tag.Year = 1999;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (1999, tag.Year, "Value Set: " + m);
  			});
  			
  			tag.Year = 0;
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Year, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestTrack ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, tag.Track, "Initial (Zero): " + m);
  			});
  			
  			tag.Track = 199;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (199, tag.Track, "Value Set: " + m);
  			});
  			
  			tag.Track = 0;
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.Track, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestTrackCount ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, tag.TrackCount, "Initial (Zero): " + m);
  			});
  			
  			tag.TrackCount = 199;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (199, tag.TrackCount, "Value Set: " + m);
  			});
  			
  			tag.TrackCount = 0;
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
  				Assert.AreEqual (0, t.TrackCount, "Value Cleared (Zero): " + m);
  			});
  		}
  		
  		[Test]
  		public void TestDisc ()
  		{
  			Ogg.XiphComment tag = new Ogg.XiphComment ();
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
  				Assert.AreEqual (0, tag.Disc, "Initial (Zero): " + m);
  			});
  			
  			tag.Disc = 199;
  			
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  				Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
  				Assert.AreEqual (199, tag.Disc, "Value Set: " + m);
  			});
  			
  			tag.Disc = 0;
  
  			TagTestWithSave (ref tag, delegate (Ogg.XiphComment t, string m) {
  
gt: 				Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);