Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 4c0dcd1

Browse files
committed
We're not testing null or empty images
1 parent 496c3e3 commit 4c0dcd1

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

test/UnitTests/GitHub.App/Models/AccountModelTests.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,13 @@ public static bool BitmapSourcesAreEqual(BitmapSource image1, BitmapSource image
119119

120120
public static byte[] BitmapSourceToBytes(BitmapSource image)
121121
{
122-
byte[] data = new byte[] { };
123-
if (image != null)
122+
var encoder = new BmpBitmapEncoder();
123+
encoder.Frames.Add(BitmapFrame.Create(image));
124+
using (MemoryStream ms = new MemoryStream())
124125
{
125-
try
126-
{
127-
var encoder = new BmpBitmapEncoder();
128-
encoder.Frames.Add(BitmapFrame.Create(image));
129-
using (MemoryStream ms = new MemoryStream())
130-
{
131-
encoder.Save(ms);
132-
data = ms.ToArray();
133-
}
134-
return data;
135-
}
136-
catch { }
126+
encoder.Save(ms);
127+
return ms.ToArray();
137128
}
138-
139-
return data;
140129
}
141130
}
142131
}

0 commit comments

Comments
 (0)