Skip to content

Commit

Permalink
ARPA-178 Fixed data seed
Browse files Browse the repository at this point in the history
  • Loading branch information
VILLAN3LL3 committed Mar 8, 2021
1 parent 6255b79 commit 10f3c0f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 27 deletions.
4 changes: 1 addition & 3 deletions Orso.Arpa.Persistence/Seed/PersonSeedData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ public static Person Admin
{
get
{
var person = new Person(
return new Person(
Guid.Parse("56ed7c20-ba78-4a02-936e-5e840ef0748c"),
new UserRegister.Command { GivenName = "Initial", Surname = "Admin" });
person.Create("anonymous", new DateTime(2021,1,1));
return person;
}
}
}
Expand Down
12 changes: 3 additions & 9 deletions Orso.Arpa.Persistence/Seed/RegionSeedData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,44 @@ public static Region Freiburg
{
get
{
var region = new Region
return new Region
(
Guid.Parse("3e6c559e-8d50-488d-a1ea-5dbc0f44ba9b"),
new Create.Command
{
Name = "Freiburg"
}
);
region.Create("anonymous", new DateTime(2021, 1, 1));
return region;
}
}

public static Region Stuttgart
{
get
{
var region = new Region
return new Region
(
Guid.Parse("ac9544e3-e756-486c-a1dc-62988a882ac2"),
new Create.Command
{
Name = "Stuttgart"
}
);
region.Create("anonymous", new DateTime(2021, 1, 1));
return region;
}
}

public static Region Berlin
{
get
{
var region = new Region
return new Region
(
Guid.Parse("ca3c9cce-1aee-4c50-93e1-be963542741a"),
new Create.Command
{
Name = "Berlin"
}
);
region.Create("anonymous", new DateTime(2021, 1, 1));
return region;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task Should_Modify()
Id = regionToModify.Id,
Name = modifyDto.Name,
CreatedBy = regionToModify.CreatedBy,
CreatedAt = regionToModify.CreatedAt,
CreatedAt = null,
ModifiedAt = DateTimeProvider.Instance.GetUtcNow(),
ModifiedBy = _staff.DisplayName,
};
Expand Down
11 changes: 6 additions & 5 deletions Tests/Orso.Arpa.Tests.Shared/DtoTestData/PersonDtoData.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Orso.Arpa.Application.PersonApplication;
using Orso.Arpa.Domain.Entities;
using Orso.Arpa.Persistence.Seed;
Expand All @@ -12,7 +13,7 @@ public static PersonDto Performer
get
{
Person person = PersonTestSeedData.Performer;
return CreateDto(person, "anonymous");
return CreateDto(person, "anonymous", new System.DateTime(2021, 1, 1));
}
}

Expand All @@ -21,7 +22,7 @@ public static PersonDto Staff
get
{
Person person = PersonTestSeedData.Staff;
return CreateDto(person, "anonymous");
return CreateDto(person, "anonymous", new System.DateTime(2021, 1, 1));
}
}

Expand All @@ -30,11 +31,11 @@ public static PersonDto Admin
get
{
Person person = PersonSeedData.Admin;
return CreateDto(person, "anonymous");
return CreateDto(person, null, null);
}
}

private static PersonDto CreateDto(Person person, string createdBy)
private static PersonDto CreateDto(Person person, string createdBy, DateTime? createdAt)
{
return new PersonDto
{
Expand All @@ -44,7 +45,7 @@ private static PersonDto CreateDto(Person person, string createdBy)
ModifiedAt = null,
ModifiedBy = person.ModifiedBy,
Surname = person.Surname,
CreatedAt = new System.DateTime(2021,1,1)
CreatedAt = createdAt
};
}
}
Expand Down
12 changes: 3 additions & 9 deletions Tests/Orso.Arpa.Tests.Shared/DtoTestData/RegionDtoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ public static RegionDto Freiburg
return new RegionDto
{
Id = Guid.Parse("3e6c559e-8d50-488d-a1ea-5dbc0f44ba9b"),
Name = "Freiburg",
CreatedAt = new DateTime(2021, 1, 1),
CreatedBy = "anonymous"
Name = "Freiburg"
};
}
}
Expand All @@ -40,9 +38,7 @@ public static RegionDto Berlin
return new RegionDto
{
Id = Guid.Parse("ca3c9cce-1aee-4c50-93e1-be963542741a"),
Name = "Berlin",
CreatedAt = new DateTime(2021, 1, 1),
CreatedBy = "anonymous"
Name = "Berlin"
};
}
}
Expand All @@ -54,9 +50,7 @@ public static RegionDto Stuttgart
return new RegionDto
{
Id = Guid.Parse("ac9544e3-e756-486c-a1dc-62988a882ac2"),
Name = "Stuttgart",
CreatedAt = new DateTime(2021, 1, 1),
CreatedBy = "anonymous"
Name = "Stuttgart"
};
}
}
Expand Down

0 comments on commit 10f3c0f

Please sign in to comment.