Skip to content

Commit

Permalink
added type to education dto (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
VILLAN3LL3 authored Dec 15, 2024
1 parent ceb2f6a commit e7cbdf9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using AutoMapper;
using Orso.Arpa.Application.General.Model;
using Orso.Arpa.Application.SelectValueApplication.Model;
using Orso.Arpa.Domain.General.Model;
using Orso.Arpa.Domain.MusicianProfileDomain.Model;

Expand All @@ -11,6 +12,7 @@ public class EducationDto : BaseEntityDto
public string TimeSpan { get; set; }
public string Institution { get; set; }
public Guid? TypeId { get; set; }
public SelectValueDto Type { get; set; }
public string Description { get; set; }
public byte? SortOrder { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ public async Task Should_Add_Education()
Description = createDto.Description,
SortOrder = createDto.SortOrder,
CreatedBy = _staff.DisplayName,
CreatedAt = FakeDateTime.UtcNow
CreatedAt = FakeDateTime.UtcNow,
Type = SelectValueDtoData.University
};

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static IEnumerable<TestCaseData> _testData

[Test]
[TestCaseSource(nameof(_testData))]
public void Should_Map(MusicianProfile source, MyMusicianProfileDto expectedDto)
public void Should_Map_MusicianProfile_To_MyMusicianProfileDto(MusicianProfile source, MyMusicianProfileDto expectedDto)
{
// Act
MyMusicianProfileDto mappedDto = _mapper.Map<MyMusicianProfileDto>(source);
Expand Down
3 changes: 2 additions & 1 deletion Tests/Orso.Arpa.Tests.Shared/DtoTestData/EducationDtoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public static EducationDto University
SortOrder = 1,
Id = Guid.Parse("a3541df8-8bd9-46e5-a61c-f73e30a2e2a1"),
CreatedAt = FakeDateTime.UtcNow,
CreatedBy = "anonymous"
CreatedBy = "anonymous",
Type = SelectValueDtoData.PrivateLesson
};
}
}
Expand Down
12 changes: 12 additions & 0 deletions Tests/Orso.Arpa.Tests.Shared/DtoTestData/SelectValueDtoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,17 @@ public static IList<SelectValueDto> ProjectGenres
Name = "Private ownership",
Description = ""
};

public static SelectValueDto PrivateLesson => new() {
Id = Guid.Parse("99251f16-deca-437e-84e2-a747e1a8ad7f"),
Name = "Private lesson",
Description = ""
};

public static SelectValueDto University => new() {
Id = Guid.Parse("5f071c88-813b-47c2-85a3-1d89321b7302"),
Name = "University",
Description = ""
};
}
}
5 changes: 3 additions & 2 deletions Tests/Orso.Arpa.Tests.Shared/FakeData/FakeMusicianProfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public static MusicianProfile PerformerHornMusicianProfile
profile.SetProperty(nameof(MusicianProfile.CreatedAt), FakeDateTime.UtcNow);
profile.SetProperty(nameof(MusicianProfile.Instrument), FakeSections.Horn);
Education universityEducation = EducationSeedData.University;
universityEducation.SetProperty(nameof(MusicianProfile.CreatedBy), "anonymous");
universityEducation.SetProperty(nameof(MusicianProfile.CreatedAt), FakeDateTime.UtcNow);
universityEducation.SetProperty(nameof(Education.CreatedBy), "anonymous");
universityEducation.SetProperty(nameof(Education.CreatedAt), FakeDateTime.UtcNow);
universityEducation.SetProperty(nameof(Education.Type), FakeSelectValueMappings.PrivateLesson);
profile.Educations.Add(universityEducation);
CurriculumVitaeReference mozarteum = CurriculumVitaeReferenceSeedData.Mozarteum;
mozarteum.SetProperty(nameof(MusicianProfile.CreatedBy), "anonymous");
Expand Down
10 changes: 10 additions & 0 deletions Tests/Orso.Arpa.Tests.Shared/FakeData/FakeSelectValueMappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,15 @@ public static SelectValueMapping PrivateOwnership
return selectValueMapping;
}
}

public static SelectValueMapping PrivateLesson
{
get
{
SelectValueMapping selectValueMapping = SelectValueMappingSeedData.EducationTypeMappings[0];
selectValueMapping.SetProperty(nameof(SelectValueMapping.SelectValue), SelectValueSeedData.PrivateLesson);
return selectValueMapping;
}
}
}
}

0 comments on commit e7cbdf9

Please sign in to comment.