From 96f59331a54b4f40a6d16b45168c6956362bbb22 Mon Sep 17 00:00:00 2001 From: jarekrzdbk Date: Fri, 19 Aug 2016 15:42:08 +0300 Subject: [PATCH 1/2] added Validation to Get File List activity --- terminalDropbox/Activities/Get_File_List_v1.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/terminalDropbox/Activities/Get_File_List_v1.cs b/terminalDropbox/Activities/Get_File_List_v1.cs index 8f0df3d62d..fe97abfc48 100644 --- a/terminalDropbox/Activities/Get_File_List_v1.cs +++ b/terminalDropbox/Activities/Get_File_List_v1.cs @@ -90,7 +90,17 @@ public override async Task FollowUp() Storage.ReplaceByLabel(PackDropboxFileListCrate(fileList)); } - + protected override Task Validate() + { + if (string.IsNullOrEmpty(ActivityUI.FileList.Value)) + { + ValidationManager.SetError("File must be selected", ActivityUI.FileList); + } + + return Task.FromResult(0); + } + + public override async Task Run() { From 044831af6a1ada63cb87227da5aaf634e6c55600 Mon Sep 17 00:00:00 2001 From: jarekrzdbk Date: Fri, 19 Aug 2016 18:18:17 +0300 Subject: [PATCH 2/2] fixed test --- .../terminalDropboxTests/Integration/Get_File_List_v1_Tests.cs | 3 +++ terminalDropbox/Activities/Get_File_List_v1.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/terminalDropboxTests/Integration/Get_File_List_v1_Tests.cs b/Tests/terminalDropboxTests/Integration/Get_File_List_v1_Tests.cs index 6f357d8d5b..f73d739291 100644 --- a/Tests/terminalDropboxTests/Integration/Get_File_List_v1_Tests.cs +++ b/Tests/terminalDropboxTests/Integration/Get_File_List_v1_Tests.cs @@ -7,6 +7,7 @@ using Fr8.Infrastructure.Data.Managers; using Fr8.Infrastructure.Data.Manifests; using terminalDropboxTests.Fixtures; +using Fr8.Infrastructure.Data.Control; namespace terminalDropboxTests.Integration { @@ -50,6 +51,7 @@ public async Task Activate_Returns_ActivityDTO() using (var crateStorage = Crate.GetUpdatableStorage(dataDto.ActivityDTO)) { crateStorage.Add("Configuration_Controls", new StandardConfigurationControlsCM()); + crateStorage.FirstCrateOrDefault().Content.Controls.Add(new DropDownList() { Name = "Test_Name", Label = "Test Label", Value = "test" }); } //Act @@ -75,6 +77,7 @@ public async Task Run_Returns_ActivityDTO() using (var crateStorage = Crate.GetUpdatableStorage(dataDto.ActivityDTO)) { crateStorage.Add("Configuration_Controls", new StandardConfigurationControlsCM()); + crateStorage.FirstCrateOrDefault().Content.Controls.Add(new DropDownList() { Name = "Test_Name", Label = "Test Label", Value = "test" }); } // Add operational state crate AddOperationalStateCrate(dataDto, new OperationalStateCM()); diff --git a/terminalDropbox/Activities/Get_File_List_v1.cs b/terminalDropbox/Activities/Get_File_List_v1.cs index fe97abfc48..c9dfd3a209 100644 --- a/terminalDropbox/Activities/Get_File_List_v1.cs +++ b/terminalDropbox/Activities/Get_File_List_v1.cs @@ -92,7 +92,7 @@ public override async Task FollowUp() protected override Task Validate() { - if (string.IsNullOrEmpty(ActivityUI.FileList.Value)) + if (string.IsNullOrEmpty(ActivityPayload.CrateStorage.FirstCrate().Content.Controls.FirstOrDefault().Value)) { ValidationManager.SetError("File must be selected", ActivityUI.FileList); }