Skip to content

Commit

Permalink
Added color field tests
Browse files Browse the repository at this point in the history
  • Loading branch information
filipmatsman committed Dec 13, 2020
1 parent a0fcd98 commit 8319ac0
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/Piranha.Tests/Fields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,52 @@ public void CheckBoxFieldNotEquals() {
Assert.True(!field1.Equals((object)field2));
}

[Fact]
public void ColorFieldConversions()
{
var inStr = "#007eaa";

Piranha.Extend.Fields.ColorField field = inStr;
Assert.Equal(inStr, field.Value);

string outStr = field;
Assert.Equal(inStr, outStr);
}

[Fact]
public void ColorFieldEquals()
{
var field1 = new Piranha.Extend.Fields.ColorField
{
Value = "#007eaa"
};
var field2 = new Piranha.Extend.Fields.ColorField
{
Value = "#007eaa"
};

Assert.True(field1 == field2);
Assert.True(field1.Equals(field2));
Assert.True(field1.Equals((object)field2));
}

[Fact]
public void ColorFieldNotEquals()
{
var field1 = new Piranha.Extend.Fields.ColorField
{
Value = "#007eaa"
};
var field2 = new Piranha.Extend.Fields.ColorField
{
Value = null
};

Assert.True(field1 != field2);
Assert.True(!field1.Equals(field2));
Assert.True(!field1.Equals((object)field2));
}

[Fact]
public void DateFieldConversions() {
var now = DateTime.Now;
Expand Down

0 comments on commit 8319ac0

Please sign in to comment.