Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #198 from AppliedIS/fix-addtotaldisabledworkers
Browse files Browse the repository at this point in the history
add TotalDisabledWorkers field
  • Loading branch information
jefferey committed Dec 1, 2016
2 parents 947229c + d48aa4f commit fe5af22
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public EmployerValidatorInitial(IAddressValidator addressValidator)
RuleFor(e => e.SCACount).NotNull();
RuleFor(e => e.SCAAttachmentId).NotNull();
});
RuleFor(e => e.TotalDisabledWorkers).NotNull().When(e => e.RepresentativePayee.GetValueOrDefault());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@
<Compile Include="Migrations\201612012033496_FixMigrations.Designer.cs">
<DependentUpon>201612012033496_FixMigrations.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201612012113292_AddTotalDisabledWorkers.cs" />
<Compile Include="Migrations\201612012113292_AddTotalDisabledWorkers.Designer.cs">
<DependentUpon>201612012113292_AddTotalDisabledWorkers.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\ApplicationRepository.cs" />
Expand Down Expand Up @@ -410,6 +414,9 @@
<EmbeddedResource Include="Migrations\201612012033496_FixMigrations.resx">
<DependentUpon>201612012033496_FixMigrations.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201612012113292_AddTotalDisabledWorkers.resx">
<DependentUpon>201612012113292_AddTotalDisabledWorkers.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace DOL.WHD.Section14c.DataAccess.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class AddTotalDisabledWorkers : DbMigration
{
public override void Up()
{
AddColumn("dbo.EmployerInfoes", "TotalDisabledWorkers", c => c.Int());
}

public override void Down()
{
DropColumn("dbo.EmployerInfoes", "TotalDisabledWorkers");
}
}
}

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions DOL.WHD.Section14c.Domain/Models/Submission/EmployerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public EmployerInfo()

public bool? RepresentativePayee { get; set; }

public int? TotalDisabledWorkers { get; set; }

public bool? TakeCreditForCosts { get; set; }

public IEnumerable<int> ProvidingFacilitiesDeductionTypeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,21 @@ public void Should_Require_SCAAttachment()
model = new EmployerInfo { SCAId = ResponseIds.SCA.Yes, SCAAttachmentId = null };
EmployerValidator.ShouldHaveValidationErrorFor(e => e.SCAAttachmentId, model);
}

[TestMethod]
public void Should_Not_Require_TotalDisabledWorkers_No_RepresentativePayee()
{
var model = new EmployerInfo {RepresentativePayee = false, TotalDisabledWorkers = null};
EmployerValidator.ShouldNotHaveValidationErrorFor(e => e.TotalDisabledWorkers, model);
}

[TestMethod]
public void Should_Require_TotalDisabledWorkers_RepresentativePayee()
{
var model = new EmployerInfo { RepresentativePayee = true, TotalDisabledWorkers = null };
EmployerValidator.ShouldHaveValidationErrorFor(e => e.TotalDisabledWorkers, model);
model = new EmployerInfo { RepresentativePayee = true, TotalDisabledWorkers = 4 };
EmployerValidator.ShouldNotHaveValidationErrorFor(e => e.TotalDisabledWorkers, model);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,21 @@ public void Should_Require_SCAAttachment()
model = new EmployerInfo { SCAId = ResponseIds.SCA.Yes, SCAAttachmentId = null };
EmployerValidator.ShouldHaveValidationErrorFor(e => e.SCAAttachmentId, model);
}

[TestMethod]
public void Should_Not_Require_TotalDisabledWorkers_No_RepresentativePayee()
{
var model = new EmployerInfo { RepresentativePayee = false, TotalDisabledWorkers = null };
EmployerValidator.ShouldNotHaveValidationErrorFor(e => e.TotalDisabledWorkers, model);
}

[TestMethod]
public void Should_Require_TotalDisabledWorkers_RepresentativePayee()
{
var model = new EmployerInfo { RepresentativePayee = true, TotalDisabledWorkers = null };
EmployerValidator.ShouldHaveValidationErrorFor(e => e.TotalDisabledWorkers, model);
model = new EmployerInfo { RepresentativePayee = true, TotalDisabledWorkers = 4 };
EmployerValidator.ShouldNotHaveValidationErrorFor(e => e.TotalDisabledWorkers, model);
}
}
}

0 comments on commit fe5af22

Please sign in to comment.