forked from awesome-inc/FontAwesome.Sharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Windows.Media; | ||
using FluentAssertions.Execution; | ||
using FluentAssertions.Primitives; | ||
|
||
namespace FontAwesome.Sharp.Tests.WPF | ||
{ | ||
internal static class TestExtensions | ||
{ | ||
public static ImageSourceAssertions Should(this ImageSource imageSource) | ||
{ | ||
return new(imageSource); | ||
} | ||
|
||
internal class ImageSourceAssertions : ReferenceTypeAssertions<ImageSource, ImageSourceAssertions> | ||
{ | ||
public ImageSourceAssertions(ImageSource imageSource) : base(imageSource) | ||
{ | ||
} | ||
|
||
protected override string Identifier => nameof(ImageSource); | ||
|
||
public void NotBeEmpty() | ||
{ | ||
Execute.Assertion.FailWith("Expected {context} not to be empty, but was."); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System.Drawing; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace FontAwesome.Sharp.Tests.WindowsForms | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System.Drawing; | ||
using FluentAssertions.Execution; | ||
using FluentAssertions.Primitives; | ||
|
||
namespace FontAwesome.Sharp.Tests.WindowsForms | ||
{ | ||
internal static class TestExtensions | ||
{ | ||
public static BitmapAssertions Should(this Bitmap bitmap) | ||
{ | ||
return new(bitmap); | ||
} | ||
|
||
//public static ColorAssertions Should(this Color color) | ||
//{ | ||
// return new ColorAssertions(color); | ||
//} | ||
|
||
/* | ||
internal class ColorAssertions : ObjectAssertions //ReferenceTypeAssertions<Color, ColorAssertions> | ||
{ | ||
public ColorAssertions(Color color) : base(color) | ||
{ | ||
} | ||
protected override string Identifier => nameof(Color); | ||
}*/ | ||
|
||
internal class BitmapAssertions : ReferenceTypeAssertions<Bitmap, BitmapAssertions> | ||
{ | ||
public BitmapAssertions(Bitmap bitmap) : base(bitmap) | ||
{ | ||
} | ||
|
||
protected override string Identifier => nameof(Bitmap); | ||
|
||
public void NotBeEmpty() | ||
{ | ||
for (var y = 0; y < Subject.Height; y++) | ||
for (var x = 0; x < Subject.Width; x++) | ||
{ | ||
var color = Subject.GetPixel(x, y); | ||
var isEmpty = color.IsEmpty || color.ToArgb() == 0; | ||
if (!isEmpty) | ||
return; | ||
} | ||
|
||
Execute.Assertion.FailWith("Expected {context} not to be empty, but was."); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters