-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WatchList.WinForms - Added input parameter "IMessageBox" to form constructors. * WatchList.Core - Changed constructor class "DownloadDataService" and the place to call the extension method "ReplaceIdIsNotFree". * Solution - Changes using "WatchItemRepository" instead of "WatchCinemaDbContext". * WatchList.WinForms - Add DI container in "Program". * Solution - Add interface "ILoadRulesConfig" and class "TestLoadRuleConfig"; Rename "ModelProcessUploadData" -> "LoadRulesConfigModel"; Used new class and interface. * WatchList.Test - Add folder "Components" and transferred the classes "TestAppDbContextFactory" and "TestLoadRuleConfig" * WatchList.Test - Add class "TestAggregateLoadRule" and used it in "Download..." test classes.
- Loading branch information
1 parent
7ab1d73
commit 97a8f97
Showing
32 changed files
with
265 additions
and
164 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using WatchList.Core.Model.ItemCinema.Components; | ||
|
||
namespace WatchList.Core.Model.Load | ||
{ | ||
public interface ILoadRulesConfig | ||
{ | ||
bool DeleteGrade { get; } | ||
|
||
ActionDuplicateItems ActionsWithDuplicates { get; } | ||
|
||
TypeCinema TypeCinemaLoad { get; } | ||
|
||
Grade MoreGrade { get; } | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
WatchList.Core/Repository/Extension/DuplicateIdExtension.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,14 @@ | ||
using WatchList.Core.Model.ItemCinema; | ||
using WatchList.Core.Repository.Db; | ||
|
||
namespace WatchList.Core.Repository.Extension | ||
{ | ||
public static class DuplicateIdExtension | ||
{ | ||
public static Guid ReplaceIdIsNotFree(this WatchCinemaDbContext dbContext, WatchItem item) | ||
{ | ||
var idDuplicate = dbContext.WatchItem.Where(x => x.Id == item.Id).Take(2).Select(x => x.Id).ToList(); | ||
return idDuplicate.Count != 0 ? Guid.NewGuid() : item.Id; | ||
} | ||
} | ||
} |
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
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
3 changes: 2 additions & 1 deletion
3
WatchList.Core/Service/DataLoading/Rules/FilterByTypeCinemaLoadRule.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
25 changes: 0 additions & 25 deletions
25
WatchList.Core/Service/Extension/DuplicateItemExtension.cs
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using WatchList.Core.Repository; | ||
using WatchList.Core.Service.DataLoading.Rules; | ||
|
||
namespace WatchList.Test.Components | ||
{ | ||
public class TestAggregateLoadRule : AggregateLoadRule | ||
{ | ||
public TestAggregateLoadRule(WatchItemRepository itemRepository, TestLoadRuleConfig loadRulesConfig) | ||
: base(new ILoadRule[] | ||
{ | ||
new DeleteGradeRule(loadRulesConfig), | ||
new FilterByTypeCinemaLoadRule(loadRulesConfig), | ||
new FilterByMoreGradeLoadRule(loadRulesConfig), | ||
new DuplicateLoadRule(itemRepository, loadRulesConfig), | ||
}) | ||
{ | ||
} | ||
} | ||
} |
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,28 @@ | ||
using WatchList.Core.Model.ItemCinema.Components; | ||
using WatchList.Core.Model.Load; | ||
|
||
namespace WatchList.Test.Components | ||
{ | ||
public class TestLoadRuleConfig : ILoadRulesConfig | ||
{ | ||
public TestLoadRuleConfig() | ||
{ | ||
} | ||
|
||
public TestLoadRuleConfig(bool deleteGrade, TypeCinema typeCinema, Grade grade, ActionDuplicateItems actionDuplicateItems) | ||
{ | ||
DeleteGrade = deleteGrade; | ||
TypeCinemaLoad = typeCinema; | ||
MoreGrade = grade; | ||
ActionsWithDuplicates = actionDuplicateItems; | ||
} | ||
|
||
public bool DeleteGrade { get; set; } = false; | ||
|
||
public TypeCinema TypeCinemaLoad { get; set; } = TypeCinema.AllType; | ||
|
||
public Grade MoreGrade { get; set; } = Grade.AnyGrade; | ||
|
||
public ActionDuplicateItems ActionsWithDuplicates { get; set; } = new ActionDuplicateItems(); | ||
} | ||
} |
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
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
Oops, something went wrong.