Skip to content

Commit 3d01b42

Browse files
committed
Added Test and Buulder for ProfileInformationEntry
1 parent ee76c40 commit 3d01b42

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using LinkDotNet.Domain;
2+
3+
namespace LinkDotNet.Blog.TestUtilities
4+
{
5+
public class ProfileInformationEntryBuilder
6+
{
7+
private string key = "Key";
8+
private string value = "Value";
9+
10+
public ProfileInformationEntryBuilder WithKey(string key)
11+
{
12+
this.key = key;
13+
return this;
14+
}
15+
16+
public ProfileInformationEntryBuilder WithValue(string value)
17+
{
18+
this.value = value;
19+
return this;
20+
}
21+
22+
public ProfileInformationEntry Build()
23+
{
24+
return ProfileInformationEntry.Create(key, value);
25+
}
26+
}
27+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using FluentAssertions;
3+
using LinkDotNet.Domain;
4+
using Xunit;
5+
6+
namespace LinkDotNet.Blog.UnitTests.Domain
7+
{
8+
public class ProfileInformationEntryTests
9+
{
10+
[Fact]
11+
public void ShouldCreateObject()
12+
{
13+
var result = ProfileInformationEntry.Create("key", "value");
14+
15+
result.Key.Should().Be("key");
16+
result.Value.Should().Be("value");
17+
}
18+
19+
[Theory]
20+
[InlineData("", "V")]
21+
[InlineData(" ", "V")]
22+
[InlineData(null, "V")]
23+
[InlineData("K", "")]
24+
[InlineData("K", " ")]
25+
[InlineData("K", null)]
26+
public void ShouldThrowExceptionWhenEmptyKeyOrValue(string key, string value)
27+
{
28+
Action act = () => ProfileInformationEntry.Create(key, value);
29+
30+
act.Should().Throw<ArgumentOutOfRangeException>();
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)