-
Notifications
You must be signed in to change notification settings - Fork 0
/
TagTest.cs
45 lines (38 loc) · 1014 Bytes
/
TagTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using Xunit;
using System.Collections.Generic;
using PoEAAValueObject.Example;
namespace PoEAAValueObject.Tests;
public class TagTests
{
[Fact]
public void TestIsNotEqualNull()
{
var tag = new Tag(text: "work");
Assert.False(tag.Equals(null));
}
[Fact]
public void TestIsNotEqualDifferentInstance()
{
var tag = new Tag(text: "work");
var person = new Person(firstName: "Kaio", lastName: "Silveira");
Assert.False(tag.Equals(person));
}
[Fact]
public void TestIsEqualAnotherTagWithSameText()
{
var tag1 = new Tag(text: "work");
var tag2 = new Tag(text: "work");
Assert.Equal(tag1, tag2);
}
[Fact]
public void TestIsFoundCorrectlyInsideHashSets()
{
var tag = new Tag(text: "work");
var hashSet = new HashSet<Tag>();
hashSet.Add(tag);
Assert.Single(hashSet);
var result = new Tag(text: "");
Assert.True(hashSet.TryGetValue(tag, out result));
Assert.Equal(tag, result);
}
}