This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
forked from 18F/dol-whd-14c
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from AppliedIS/fix-esignature
Restored AddSignature
- Loading branch information
Showing
16 changed files
with
342 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
DOL.WHD.Section14c.Business/Validators/ISignatureValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using DOL.WHD.Section14c.Domain.Models.Submission; | ||
using FluentValidation; | ||
|
||
namespace DOL.WHD.Section14c.Business.Validators | ||
{ | ||
public interface ISignatureValidator : IValidator<Signature> | ||
{ | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
DOL.WHD.Section14c.Business/Validators/SignatureValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using DOL.WHD.Section14c.Domain.Models.Submission; | ||
using FluentValidation; | ||
|
||
namespace DOL.WHD.Section14c.Business.Validators | ||
{ | ||
public class SignatureValidator : AbstractValidator<Signature>, ISignatureValidator | ||
{ | ||
public SignatureValidator() | ||
{ | ||
RuleFor(s => s.Agreement).Equal(true); | ||
RuleFor(s => s.FullName).NotEmpty(); | ||
RuleFor(s => s.Title).NotEmpty(); | ||
RuleFor(s => s.Date).NotEmpty(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
DOL.WHD.Section14c.DataAccess/Migrations/201611101838282_AddSignature.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
DOL.WHD.Section14c.DataAccess/Migrations/201611101838282_AddSignature.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace DOL.WHD.Section14c.DataAccess.Migrations | ||
{ | ||
using System; | ||
using System.Data.Entity.Migrations; | ||
|
||
public partial class AddSignature : DbMigration | ||
{ | ||
public override void Up() | ||
{ | ||
CreateTable( | ||
"dbo.Signatures", | ||
c => new | ||
{ | ||
Id = c.Guid(nullable: false), | ||
Agreement = c.Boolean(nullable: false), | ||
FullName = c.String(nullable: false), | ||
Title = c.String(nullable: false), | ||
Date = c.DateTime(nullable: false), | ||
CreatedBy_Id = c.String(), | ||
CreatedAt = c.DateTime(nullable: false), | ||
LastModifiedBy_Id = c.String(maxLength: 128), | ||
LastModifiedAt = c.DateTime(nullable: false), | ||
}) | ||
.PrimaryKey(t => t.Id) | ||
.ForeignKey("dbo.Users", t => t.LastModifiedBy_Id) | ||
.Index(t => t.LastModifiedBy_Id); | ||
|
||
AddColumn("dbo.ApplicationSubmissions", "Signature_Id", c => c.Guid()); | ||
CreateIndex("dbo.ApplicationSubmissions", "Signature_Id"); | ||
AddForeignKey("dbo.ApplicationSubmissions", "Signature_Id", "dbo.Signatures", "Id"); | ||
} | ||
|
||
public override void Down() | ||
{ | ||
DropForeignKey("dbo.ApplicationSubmissions", "Signature_Id", "dbo.Signatures"); | ||
DropForeignKey("dbo.Signatures", "LastModifiedBy_Id", "dbo.Users"); | ||
DropIndex("dbo.Signatures", new[] { "LastModifiedBy_Id" }); | ||
DropIndex("dbo.ApplicationSubmissions", new[] { "Signature_Id" }); | ||
DropColumn("dbo.ApplicationSubmissions", "Signature_Id"); | ||
DropTable("dbo.Signatures"); | ||
} | ||
} | ||
} |
126 changes: 126 additions & 0 deletions
126
DOL.WHD.Section14c.DataAccess/Migrations/201611101838282_AddSignature.resx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
namespace DOL.WHD.Section14c.Domain.Models.Submission | ||
{ | ||
public class Signature : BaseEntity | ||
{ | ||
public Signature() | ||
{ | ||
Id = Guid.NewGuid(); | ||
} | ||
|
||
public Guid Id { get; set; } | ||
public bool? Agreement { get; set; } | ||
public string FullName { get; set; } | ||
public string Title { get; set; } | ||
public DateTime Date { get; set; } | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
DOL.WHD.Section14c.Test/Business/Validators/SignatureValidatorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using DOL.WHD.Section14c.Business.Validators; | ||
using FluentValidation.TestHelper; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace DOL.WHD.Section14c.Test.Business.Validators | ||
{ | ||
[TestClass] | ||
public class SignatureValidatorTests | ||
{ | ||
private ISignatureValidator _signatureValidator; | ||
public SignatureValidatorTests() | ||
{ | ||
_signatureValidator = new SignatureValidator(); | ||
} | ||
|
||
[TestMethod] | ||
public void Should_Require_Agreement() | ||
{ | ||
_signatureValidator.ShouldHaveValidationErrorFor(x => x.Agreement, null as bool?); | ||
} | ||
|
||
[TestMethod] | ||
public void Should_Require_FullName() | ||
{ | ||
_signatureValidator.ShouldHaveValidationErrorFor(x => x.FullName, ""); | ||
} | ||
|
||
[TestMethod] | ||
public void Should_Require_Title() | ||
{ | ||
_signatureValidator.ShouldHaveValidationErrorFor(x => x.Title, ""); | ||
} | ||
|
||
[TestMethod] | ||
public void Should_Require_Date() | ||
{ | ||
_signatureValidator.ShouldHaveValidationErrorFor(x => x.Date, default(DateTime)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
DOL.WHD.Section14c.Test/Domain/Models/Submission/SignatureTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using DOL.WHD.Section14c.Domain.Models.Submission; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace DOL.WHD.Section14c.Test.Domain.Models.Submission | ||
{ | ||
[TestClass] | ||
public class SignatureTests | ||
{ | ||
[TestMethod] | ||
public void Signature_PublicProperties() | ||
{ | ||
var agreement = true; | ||
var fullName = "Full Name"; | ||
var title = "Title"; | ||
var date = DateTime.Now; | ||
|
||
var model = new Signature | ||
{ | ||
Agreement = agreement, | ||
FullName = fullName, | ||
Title = title, | ||
Date = date | ||
}; | ||
|
||
Assert.AreEqual(agreement, model.Agreement); | ||
Assert.AreEqual(fullName, model.FullName); | ||
Assert.AreEqual(title, model.Title); | ||
Assert.AreEqual(date, model.Date); | ||
} | ||
} | ||
} |