From e7bd2206b4ea1370ffc57d74f7ca64375bbae25d Mon Sep 17 00:00:00 2001 From: Simon G Date: Fri, 13 Nov 2020 13:23:18 +0100 Subject: [PATCH] - adapt test classes --- Test.GBase/GBaseIntegrationTest/Group.cs | 9 +++++++++ Test.GBase/GBaseIntegrationTest/Item.cs | 12 ++++++++++++ Test.GBase/GBaseIntegrationTest/Model.cs | 12 ++++++------ Test.GBase/GBaseTableIntegrationTest.cs | 5 +++-- Test.GBase/TestClasses/Foo.cs | 19 ++++++++++++++++++- Test.GBase/TestClasses/UserType.cs | 6 ++++++ 6 files changed, 54 insertions(+), 9 deletions(-) diff --git a/Test.GBase/GBaseIntegrationTest/Group.cs b/Test.GBase/GBaseIntegrationTest/Group.cs index b9587af..0976ea5 100644 --- a/Test.GBase/GBaseIntegrationTest/Group.cs +++ b/Test.GBase/GBaseIntegrationTest/Group.cs @@ -10,6 +10,11 @@ namespace Test.GBase.GBaseIntegrationTest [GBaseTable("Groups")] public class Group : IGroup { + public Group() + { + Items = new List(); + } + public Group(int key) { Key = key; @@ -22,5 +27,9 @@ namespace Test.GBase.GBaseIntegrationTest public override string ToString() => $"{Key}"; public void InitializeFromString(string @string) => Key = int.Parse(@string); + public void Initialize(List parameters) + { + Key = (int) parameters[0]; + } } } \ No newline at end of file diff --git a/Test.GBase/GBaseIntegrationTest/Item.cs b/Test.GBase/GBaseIntegrationTest/Item.cs index e49acd8..44e38f5 100644 --- a/Test.GBase/GBaseIntegrationTest/Item.cs +++ b/Test.GBase/GBaseIntegrationTest/Item.cs @@ -2,6 +2,7 @@ // Created: 2020-09-18 // Copyright(c) 2020 SimonG. All Rights Reserved. +using System.Collections.Generic; using GBase.Attributes; namespace Test.GBase.GBaseIntegrationTest @@ -9,6 +10,11 @@ namespace Test.GBase.GBaseIntegrationTest [GBaseTable("Items")] public class Item : IItem { + public Item() + { + + } + public Item(string name, int key) { Name = name; @@ -30,5 +36,11 @@ namespace Test.GBase.GBaseIntegrationTest Key = int.Parse(properties[0]); Name = properties[1]; } + + public void Initialize(List parameters) + { + Name = (string) parameters[0]; + Key = (int) parameters[1]; + } } } \ No newline at end of file diff --git a/Test.GBase/GBaseIntegrationTest/Model.cs b/Test.GBase/GBaseIntegrationTest/Model.cs index 0b608a7..a446b8f 100644 --- a/Test.GBase/GBaseIntegrationTest/Model.cs +++ b/Test.GBase/GBaseIntegrationTest/Model.cs @@ -30,13 +30,13 @@ namespace Test.GBase.GBaseIntegrationTest { await _gBase.Init("DB", Assembly.GetExecutingAssembly(), cancellationToken); - // IGBaseTable itemsTable = _gBase.GetTable(); - // Items = itemsTable.Entries.Cast().ToList(); - Items = (await _gBase.GetValues(this, nameof(Items), cancellationToken)).Cast().ToList(); + IGBaseTable itemsTable = _gBase.GetTable(); + Items = itemsTable.Entries.Cast().ToList(); + //Items = (await _gBase.GetValues(this, nameof(Items), cancellationToken)).Cast().ToList(); - // IGBaseTable groupsTable = _gBase.GetTable(); - // Groups = groupsTable.Entries.Cast().ToList(); - Groups = (await _gBase.GetValues(this, nameof(Groups), cancellationToken)).Cast().ToList(); + IGBaseTable groupsTable = _gBase.GetTable(); + Groups = groupsTable.Entries.Cast().ToList(); + //Groups = (await _gBase.GetValues(this, nameof(Groups), cancellationToken)).Cast().ToList(); } public async Task AddItem(Item item, CancellationToken cancellationToken) diff --git a/Test.GBase/GBaseTableIntegrationTest.cs b/Test.GBase/GBaseTableIntegrationTest.cs index cf69136..8d2269f 100644 --- a/Test.GBase/GBaseTableIntegrationTest.cs +++ b/Test.GBase/GBaseTableIntegrationTest.cs @@ -2,6 +2,7 @@ // Created: 2020-03-09 // Copyright(c) 2020 SimonG. All Rights Reserved. +using System; using System.Threading; using GBase; using GBase.Factories; @@ -26,8 +27,8 @@ namespace Test.GBase IGBaseColumn gBaseColumn = null; Mock gBaseColumnFactoryMock = new Mock(); - gBaseColumnFactoryMock.Setup(c => c.Create(It.IsAny())) - .Callback(name => { gBaseColumn = new GBaseColumn(name); }) + gBaseColumnFactoryMock.Setup(c => c.Create(It.IsAny(), It.IsAny())) + .Callback((name, type) => { gBaseColumn = new GBaseColumn(name, type); }) .Returns(gBaseColumn); Mock dataHandlerPoolMock = new Mock(); diff --git a/Test.GBase/TestClasses/Foo.cs b/Test.GBase/TestClasses/Foo.cs index 2cfbb7c..9213c15 100644 --- a/Test.GBase/TestClasses/Foo.cs +++ b/Test.GBase/TestClasses/Foo.cs @@ -2,16 +2,23 @@ // Created: 2020-01-27 // Copyright(c) 2020 SimonG. All Rights Reserved. +using System; +using System.Collections.Generic; using GBase.Api; using GBase.Attributes; namespace Test.GBase.TestClasses { [GBaseTable("Foo")] - public class Foo : NotifyGBaseEntryChanged + public class Foo : NotifyGBaseEntryChanged, IGBaseObject { private string _name; + public Foo() + { + + } + public Foo(string name) { Name = name; @@ -27,5 +34,15 @@ namespace Test.GBase.TestClasses RaiseGBaseEntryChanged(this, nameof(Name), _name); } } + + public void InitializeFromString(string @string) + { + throw new NotImplementedException(); + } + + public void Initialize(List parameters) + { + throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/Test.GBase/TestClasses/UserType.cs b/Test.GBase/TestClasses/UserType.cs index 6b81c1f..53cf071 100644 --- a/Test.GBase/TestClasses/UserType.cs +++ b/Test.GBase/TestClasses/UserType.cs @@ -3,6 +3,7 @@ // Copyright(c) 2020 SimonG. All Rights Reserved. using System; +using System.Collections.Generic; using System.Linq; namespace Test.GBase.TestClasses @@ -27,6 +28,11 @@ namespace Test.GBase.TestClasses Number = Convert.ToInt32(numberString); } + public void Initialize(List parameters) + { + throw new NotImplementedException(); + } + public override string ToString() => $"{nameof(UserType)}_{nameof(Number)}_{Number}"; public override bool Equals(object obj)