// [TestCase(null)] public void ShouldRoundWeeklyWageToTwoDecimalPlacesFromDatabaseToDomain( string weeklyWageString, string expectedWeeklyWageString) { // Arrange. var weeklyWage = default(decimal?); if (!string.IsNullOrWhiteSpace(weeklyWageString)) { weeklyWage = decimal.Parse(weeklyWageString); } var expectedWeeklyWage = default(decimal?); if (!string.IsNullOrWhiteSpace(expectedWeeklyWageString)) { expectedWeeklyWage = decimal.Parse(expectedWeeklyWageString); } var mapper = new VacancyMappers(); var databaseVacancy = new Fixture() .Build <Vacancy>() .With(each => each.WeeklyWage, weeklyWage) .With(each => each.WageUnitId, 1) .Create(); // Act var domainVacancy = mapper.Map <Vacancy, DomainVacancy>(databaseVacancy); // Assert domainVacancy.Wage.Amount.Should().Be(expectedWeeklyWage); }
public void DoesDatabaseVacancyObjectToDomainObjectMapperChokeInPractice() { // Arrange var mapper = new VacancyMappers(); var databaseVacancyLocation = CreateValidDatabaseVacancyLocation(); // Act / Assert no exception mapper.Map <DbVacancyLocation, DomainVacancyLocation>(databaseVacancyLocation); }
public void DoesDatabaseVacancyObjectToDomainObjectMapperChokeInPractice() { // Arrange var mapper = new VacancyMappers(); var vacancy = CreateValidDatabaseVacancy(); // Act / Assert no exception mapper.Map <Vacancy, DomainVacancy>(vacancy); }
public void DoMappersMapEverything() { // Arrange var x = new VacancyMappers(); // Act x.Initialise(); // Assert x.Mapper.AssertConfigurationIsValid(); }
public void DoesVacancyLocationDomainObjectToDatabaseObjectMapperChokeInPractice() { // Arrange var x = new VacancyMappers(); var vacancy = new Fixture().Build <DomainVacancyLocation>() .Create(); // Act / Assert no exception x.Map <DomainVacancyLocation, DbVacancyLocation>(vacancy); }
public void DatabaseToDomainWageTypeTests(int databaseWageType, WageType expectedWageType) { var mapper = new VacancyMappers(); var databaseVacancy = new Fixture() .Build <Vacancy>() .With(v => v.WageType, databaseWageType) .With(v => v.WageUnitId, 1) .Create(); var domainVacancy = mapper.Map <Vacancy, DomainVacancy>(databaseVacancy); domainVacancy.Wage.Type.Should().Be(expectedWageType); }
public void DoesApprenticeshipVacancyDomainObjectToDatabaseObjectMapperChokeInPractice() { // Arrange var x = new VacancyMappers(); var vacancy = new Fixture().Build <DomainVacancy>() .With(av => av.Status, VacancyStatus.Submitted) .With(av => av.QAUserName, null) .With(av => av.DateStartedToQA, null) .Create(); // Act / Assert no exception x.Map <DomainVacancy, Vacancy>(vacancy); }
public void DoesVacancyLocationDomainObjectMappingRoundTripViaDatabaseObject() { // Arrange var mapper = new VacancyMappers(); var databaseVacancyLocation1 = CreateValidDatabaseVacancyLocation(); // Act var domainVacancyLocation = mapper.Map <DbVacancyLocation, DomainVacancyLocation>(databaseVacancyLocation1); var databaseVacancyLocation2 = mapper.Map <DomainVacancyLocation, DbVacancyLocation>(domainVacancyLocation); // Assert databaseVacancyLocation2.ShouldBeEquivalentTo(databaseVacancyLocation1, options => options .Excluding(vl => vl.EmployersWebsite) .Excluding(vl => vl.CountyId) .Excluding(vl => vl.LocalAuthorityId) .Excluding(vl => vl.GeocodeEasting) .Excluding(vl => vl.GeocodeNorthing) ); }
public void DoesDatabaseVacancyObjectMappingRoundTripViaDomainObjectExcludingHardOnes() { // Arrange var mapper = new VacancyMappers(); var domainVacancyLocation1 = new Fixture().Create <DomainVacancyLocation>(); // Act var databaseVacancyLocation = mapper.Map <DomainVacancyLocation, DbVacancyLocation>(domainVacancyLocation1); var domainVacancyLocation2 = mapper.Map <DbVacancyLocation, DomainVacancyLocation>(databaseVacancyLocation); // Assert domainVacancyLocation2.ShouldBeEquivalentTo(domainVacancyLocation1, options => options .Excluding(vl => vl.Address.PostalAddressId) .Excluding(vl => vl.Address.ValidationSourceCode) .Excluding(vl => vl.Address.ValidationSourceKeyValue) .Excluding(vl => vl.Address.DateValidated) .Excluding(vl => vl.Address.County) .Excluding(vl => vl.LocalAuthorityCode)); }