diff --git a/Orso.Arpa.Persistence/Seed/PersonSeedData.cs b/Orso.Arpa.Persistence/Seed/PersonSeedData.cs index 77dc036eb..bf6c33c93 100644 --- a/Orso.Arpa.Persistence/Seed/PersonSeedData.cs +++ b/Orso.Arpa.Persistence/Seed/PersonSeedData.cs @@ -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; } } } diff --git a/Orso.Arpa.Persistence/Seed/RegionSeedData.cs b/Orso.Arpa.Persistence/Seed/RegionSeedData.cs index 0f37e47d0..35595ccea 100644 --- a/Orso.Arpa.Persistence/Seed/RegionSeedData.cs +++ b/Orso.Arpa.Persistence/Seed/RegionSeedData.cs @@ -24,7 +24,7 @@ public static Region Freiburg { get { - var region = new Region + return new Region ( Guid.Parse("3e6c559e-8d50-488d-a1ea-5dbc0f44ba9b"), new Create.Command @@ -32,8 +32,6 @@ public static Region Freiburg Name = "Freiburg" } ); - region.Create("anonymous", new DateTime(2021, 1, 1)); - return region; } } @@ -41,7 +39,7 @@ public static Region Stuttgart { get { - var region = new Region + return new Region ( Guid.Parse("ac9544e3-e756-486c-a1dc-62988a882ac2"), new Create.Command @@ -49,8 +47,6 @@ public static Region Stuttgart Name = "Stuttgart" } ); - region.Create("anonymous", new DateTime(2021, 1, 1)); - return region; } } @@ -58,7 +54,7 @@ public static Region Berlin { get { - var region = new Region + return new Region ( Guid.Parse("ca3c9cce-1aee-4c50-93e1-be963542741a"), new Create.Command @@ -66,8 +62,6 @@ public static Region Berlin Name = "Berlin" } ); - region.Create("anonymous", new DateTime(2021, 1, 1)); - return region; } } } diff --git a/Tests/Orso.Arpa.Api.Tests/IntegrationTests/RegionsControllerTests.cs b/Tests/Orso.Arpa.Api.Tests/IntegrationTests/RegionsControllerTests.cs index 7871b7c5f..d8ff5e8b3 100644 --- a/Tests/Orso.Arpa.Api.Tests/IntegrationTests/RegionsControllerTests.cs +++ b/Tests/Orso.Arpa.Api.Tests/IntegrationTests/RegionsControllerTests.cs @@ -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, }; diff --git a/Tests/Orso.Arpa.Tests.Shared/DtoTestData/PersonDtoData.cs b/Tests/Orso.Arpa.Tests.Shared/DtoTestData/PersonDtoData.cs index f3b444f31..8f0f1918c 100644 --- a/Tests/Orso.Arpa.Tests.Shared/DtoTestData/PersonDtoData.cs +++ b/Tests/Orso.Arpa.Tests.Shared/DtoTestData/PersonDtoData.cs @@ -1,3 +1,4 @@ +using System; using Orso.Arpa.Application.PersonApplication; using Orso.Arpa.Domain.Entities; using Orso.Arpa.Persistence.Seed; @@ -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)); } } @@ -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)); } } @@ -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 { @@ -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 }; } } diff --git a/Tests/Orso.Arpa.Tests.Shared/DtoTestData/RegionDtoData.cs b/Tests/Orso.Arpa.Tests.Shared/DtoTestData/RegionDtoData.cs index 0357d4e8a..6087282f6 100644 --- a/Tests/Orso.Arpa.Tests.Shared/DtoTestData/RegionDtoData.cs +++ b/Tests/Orso.Arpa.Tests.Shared/DtoTestData/RegionDtoData.cs @@ -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" }; } } @@ -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" }; } } @@ -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" }; } }