Skip to content

Commit

Permalink
Create TaskTest.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
pwelter34 committed Sep 5, 2024
1 parent 30c0151 commit b40d593
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions test/Equatable.Generator.Tests/Entities/TaskTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using Equatable.Entities;

namespace Equatable.Generator.Tests.Entities;

public class TaskTest
{
[Fact]
public void EqualNested()
{
var left = new Equatable.Entities.Task
{
Id = 1,
Title = "In Progress",
Description = "In Progress",
StartDate = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system",
Status = new Status
{
Id = 1,
Name = "In Progress",
Description = "In Progress",
IsActive = true,
DisplayOrder = 1,
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system"
}
};

var right = new Equatable.Entities.Task
{
Id = 1,
Title = "In Progress",
Description = "In Progress",
StartDate = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system",
Status = new Status
{
Id = 1,
Name = "In Progress",
Description = "In Progress",
IsActive = true,
DisplayOrder = 1,
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system"
}
};

var isEqual = left.Equals(right);
isEqual.Should().BeTrue();

// check operator ==
isEqual = left == right;
isEqual.Should().BeTrue();
}

[Fact]
public void NotEqualNested()
{
var left = new Equatable.Entities.Task
{
Id = 1,
Title = "In Progress",
Description = "In Progress",
StartDate = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system",
Status = new Status
{
Id = 1,
Name = "In Progress",
Description = "In Progress",
IsActive = true,
DisplayOrder = 1,
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system"
}
};

var right = new Equatable.Entities.Task
{
Id = 1,
Title = "In Progress",
Description = "In Progress",
StartDate = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system",
Status = new Status
{
Id = 2,
Name = "In Progress",
Description = "In Progress",
IsActive = true,
DisplayOrder = 1,
Created = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
CreatedBy = "system",
Updated = new DateTimeOffset(2024, 9, 1, 11, 30, 15, TimeSpan.Zero),
UpdatedBy = "system"
}
};

var isEqual = left.Equals(right);
isEqual.Should().BeFalse();

// check operator !=
isEqual = left != right;
isEqual.Should().BeTrue();
}

}

0 comments on commit b40d593

Please sign in to comment.