|
| 1 | +using JsonApiDotNetCore.Models; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Text; |
| 5 | +using Xunit; |
| 6 | + |
| 7 | +namespace JsonApiDotNetCoreExampleTests.Unit.Models |
| 8 | +{ |
| 9 | + public class AttributesEqualsTests |
| 10 | + { |
| 11 | + [Fact] |
| 12 | + public void HasManyAttribute_Equals_Returns_True_When_Same_Name() |
| 13 | + { |
| 14 | + var a = new HasManyAttribute("test"); |
| 15 | + var b = new HasManyAttribute("test"); |
| 16 | + |
| 17 | + Assert.Equal(a, b); |
| 18 | + } |
| 19 | + |
| 20 | + [Fact] |
| 21 | + public void HasManyAttribute_Equals_Returns_False_When_Different_Name() |
| 22 | + { |
| 23 | + var a = new HasManyAttribute("test"); |
| 24 | + var b = new HasManyAttribute("test2"); |
| 25 | + |
| 26 | + Assert.NotEqual(a, b); |
| 27 | + } |
| 28 | + |
| 29 | + [Fact] |
| 30 | + public void HasOneAttribute_Equals_Returns_True_When_Same_Name() |
| 31 | + { |
| 32 | + var a = new HasOneAttribute("test"); |
| 33 | + var b = new HasOneAttribute("test"); |
| 34 | + |
| 35 | + Assert.Equal(a, b); |
| 36 | + } |
| 37 | + |
| 38 | + [Fact] |
| 39 | + public void HasOneAttribute_Equals_Returns_False_When_Different_Name() |
| 40 | + { |
| 41 | + var a = new HasOneAttribute("test"); |
| 42 | + var b = new HasOneAttribute("test2"); |
| 43 | + |
| 44 | + Assert.NotEqual(a, b); |
| 45 | + } |
| 46 | + |
| 47 | + [Fact] |
| 48 | + public void AttrAttribute_Equals_Returns_True_When_Same_Name() |
| 49 | + { |
| 50 | + var a = new AttrAttribute("test"); |
| 51 | + var b = new AttrAttribute("test"); |
| 52 | + |
| 53 | + Assert.Equal(a, b); |
| 54 | + } |
| 55 | + |
| 56 | + [Fact] |
| 57 | + public void AttrAttribute_Equals_Returns_False_When_Different_Name() |
| 58 | + { |
| 59 | + var a = new AttrAttribute("test"); |
| 60 | + var b = new AttrAttribute("test2"); |
| 61 | + |
| 62 | + Assert.NotEqual(a, b); |
| 63 | + } |
| 64 | + |
| 65 | + [Fact] |
| 66 | + public void HasManyAttribute_Doesnt_Equal_HasOneAttribute_With_Same_Name() |
| 67 | + { |
| 68 | + RelationshipAttribute a = new HasManyAttribute("test"); |
| 69 | + RelationshipAttribute b = new HasOneAttribute("test"); |
| 70 | + |
| 71 | + Assert.NotEqual(a, b); |
| 72 | + Assert.NotEqual(b, a); |
| 73 | + } |
| 74 | + } |
| 75 | +} |
0 commit comments