public void Constructor_String() { // If a filename (string) is passed to the constructor, then // the scheme of the URI should be set as file. vCardPhoto photo = new vCardPhoto("c:\\fake-picture.gif"); Assert.IsTrue( photo.Url.IsFile); }
public void Fetch_Good() { // You may wish to ignore this test if you run // extensive unit tests and your Internet connection // is slow. vCardPhoto photo = new vCardPhoto(TestPhotoUrl); Assert.IsFalse( photo.IsLoaded, "The photo has not been loaded yet."); photo.Fetch(); Assert.IsTrue( photo.IsLoaded, "The photo should have been loaded."); // Get the bytes of the image. byte[] data = photo.GetBytes(); Assert.AreEqual( TestPhotoSize, data.Length, "The length of the photo is unexpected."); using (Bitmap bitmap = photo.GetBitmap()) { Assert.AreEqual( TestPhotoHeight, bitmap.Size.Height, "The photo height is unexpected."); Assert.AreEqual( TestPhotoWidth, bitmap.Size.Width, "The photo width is unexpected."); } }
public void Constructor_Uri_Null() { vCardPhoto photo = new vCardPhoto((Uri)null); }
public void Constructor_String_Null() { vCardPhoto photo = new vCardPhoto((string)null); }
public void Constructor_String_Empty() { vCardPhoto photo = new vCardPhoto(string.Empty); }
public static void Equals(vCardPhoto p1, vCardPhoto p2) { Assert.AreEqual( p1.IsLoaded, p2.IsLoaded, "vCardPhoto.IsLoaded differs."); Assert.AreEqual( p1.ToString(), p2.ToString(), "vCardPhoto.ToString differs."); Assert.AreEqual( p1.Url, p2.Url, "vCardPhoto.Url differs."); }