From 0e94b7a3abc171f33fcc42ed199cbdc6089b7406 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 19 Dec 2024 17:01:31 +0900 Subject: [PATCH] UnitTest run by source generator --- .../Assets/Tests/ValidatorTest.cs | 8 +- .../Generated/DatabaseBuilder.cs | 93 -- .../Generated/ImmutableBuilder.cs | 767 ------------ .../Generated/MasterMemoryResolver.cs | 90 -- .../Generated/MemoryDatabase.cs | 270 ---- .../Generated/MessagePackGenerated.cs | 1114 ----------------- .../Generated/Tables/FailTable.cs | 102 -- .../Tables/ItemMasterEmptyValidateTable.cs | 102 -- .../Generated/Tables/ItemMasterTable.cs | 102 -- .../Generated/Tables/PersonModelTable.cs | 149 --- .../Tables/QuestMasterEmptyValidateTable.cs | 105 -- .../Generated/Tables/QuestMasterTable.cs | 105 -- .../Generated/Tables/SampleTable.cs | 297 ----- .../Tables/SequentialCheckMasterTable.cs | 103 -- .../Generated/Tables/SingleMasterTable.cs | 102 -- .../Generated/Tables/SkillMasterTable.cs | 81 -- .../Generated/Tables/TestMasterTable.cs | 72 -- .../Generated/Tables/UserLevelTable.cs | 131 -- .../MasterMemory.Tests.csproj | 23 +- .../MasterMemory.Tests/MessagePackResolver.cs | 25 +- 20 files changed, 21 insertions(+), 3820 deletions(-) delete mode 100644 tests/MasterMemory.Tests/Generated/DatabaseBuilder.cs delete mode 100644 tests/MasterMemory.Tests/Generated/ImmutableBuilder.cs delete mode 100644 tests/MasterMemory.Tests/Generated/MasterMemoryResolver.cs delete mode 100644 tests/MasterMemory.Tests/Generated/MemoryDatabase.cs delete mode 100644 tests/MasterMemory.Tests/Generated/MessagePackGenerated.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/FailTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/ItemMasterEmptyValidateTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/ItemMasterTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/PersonModelTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/QuestMasterEmptyValidateTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/QuestMasterTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/SampleTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/SequentialCheckMasterTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/SingleMasterTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/SkillMasterTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/TestMasterTable.cs delete mode 100644 tests/MasterMemory.Tests/Generated/Tables/UserLevelTable.cs diff --git a/src/MasterMemory.Unity/Assets/Tests/ValidatorTest.cs b/src/MasterMemory.Unity/Assets/Tests/ValidatorTest.cs index a9973ae7..206373dc 100644 --- a/src/MasterMemory.Unity/Assets/Tests/ValidatorTest.cs +++ b/src/MasterMemory.Unity/Assets/Tests/ValidatorTest.cs @@ -112,9 +112,11 @@ public void PKUnique() validateResult.IsValidationFailed.Should().BeTrue(); validateResult.FailedResults.Count.Should().Be(3); // Q:1,4 + I:2 - validateResult.FailedResults[0].Message.Should().Be("Unique failed: QuestId, value = 1"); - validateResult.FailedResults[1].Message.Should().Be("Unique failed: QuestId, value = 4"); - validateResult.FailedResults[2].Message.Should().Be("Unique failed: ItemId, value = 2"); + var faileds = validateResult.FailedResults.OrderBy(x => x.Message).ToArray(); + + faileds[0].Message.Should().Be("Unique failed: ItemId, value = 2"); + faileds[1].Message.Should().Be("Unique failed: QuestId, value = 1"); + faileds[2].Message.Should().Be("Unique failed: QuestId, value = 4"); } // test IValidator diff --git a/tests/MasterMemory.Tests/Generated/DatabaseBuilder.cs b/tests/MasterMemory.Tests/Generated/DatabaseBuilder.cs deleted file mode 100644 index 3379a27d..00000000 --- a/tests/MasterMemory.Tests/Generated/DatabaseBuilder.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; -using MasterMemory.Tests.Tables; - -namespace MasterMemory.Tests -{ - public sealed class DatabaseBuilder : DatabaseBuilderBase - { - public DatabaseBuilder() : this(null) { } - public DatabaseBuilder(MessagePack.IFormatterResolver resolver) : base(resolver) { } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.Id, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.ItemId, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.ItemId, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.RandomId, System.StringComparer.Ordinal); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.QuestId, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.QuestId, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.Id, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.Id, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.Id, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => (x.SkillId, x.SkillLevel), System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.TestID, System.Collections.Generic.Comparer.Default); - return this; - } - - public DatabaseBuilder Append(System.Collections.Generic.IEnumerable dataSource) - { - AppendCore(dataSource, x => x.Level, System.Collections.Generic.Comparer.Default); - return this; - } - - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/ImmutableBuilder.cs b/tests/MasterMemory.Tests/Generated/ImmutableBuilder.cs deleted file mode 100644 index 7d605ab2..00000000 --- a/tests/MasterMemory.Tests/Generated/ImmutableBuilder.cs +++ /dev/null @@ -1,767 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; -using MasterMemory.Tests.Tables; - -namespace MasterMemory.Tests -{ - public sealed class ImmutableBuilder : ImmutableBuilderBase - { - MemoryDatabase memory; - - public ImmutableBuilder(MemoryDatabase memory) - { - this.memory = memory; - } - - public MemoryDatabase Build() - { - return memory; - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new FailTable(newData); - memory = new MemoryDatabase( - table, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveFail(int[] keys) - { - var data = RemoveCore(memory.FailTable.GetRawDataUnsafe(), keys, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new FailTable(newData); - memory = new MemoryDatabase( - table, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(Fail[] addOrReplaceData) - { - var data = DiffCore(memory.FailTable.GetRawDataUnsafe(), addOrReplaceData, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new FailTable(newData); - memory = new MemoryDatabase( - table, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var table = new ItemMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - table, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveItemMaster(int[] keys) - { - var data = RemoveCore(memory.ItemMasterTable.GetRawDataUnsafe(), keys, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var table = new ItemMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - table, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(ItemMaster[] addOrReplaceData) - { - var data = DiffCore(memory.ItemMasterTable.GetRawDataUnsafe(), addOrReplaceData, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var table = new ItemMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - table, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var table = new ItemMasterEmptyValidateTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - table, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveItemMasterEmptyValidate(int[] keys) - { - var data = RemoveCore(memory.ItemMasterEmptyValidateTable.GetRawDataUnsafe(), keys, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var table = new ItemMasterEmptyValidateTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - table, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(ItemMasterEmptyValidate[] addOrReplaceData) - { - var data = DiffCore(memory.ItemMasterEmptyValidateTable.GetRawDataUnsafe(), addOrReplaceData, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.ItemId, System.Collections.Generic.Comparer.Default); - var table = new ItemMasterEmptyValidateTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - table, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.RandomId, System.StringComparer.Ordinal); - var table = new PersonModelTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - table, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemovePersonModel(string[] keys) - { - var data = RemoveCore(memory.PersonModelTable.GetRawDataUnsafe(), keys, x => x.RandomId, System.StringComparer.Ordinal); - var newData = CloneAndSortBy(data, x => x.RandomId, System.StringComparer.Ordinal); - var table = new PersonModelTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - table, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(PersonModel[] addOrReplaceData) - { - var data = DiffCore(memory.PersonModelTable.GetRawDataUnsafe(), addOrReplaceData, x => x.RandomId, System.StringComparer.Ordinal); - var newData = CloneAndSortBy(data, x => x.RandomId, System.StringComparer.Ordinal); - var table = new PersonModelTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - table, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var table = new QuestMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - table, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveQuestMaster(int[] keys) - { - var data = RemoveCore(memory.QuestMasterTable.GetRawDataUnsafe(), keys, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var table = new QuestMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - table, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(QuestMaster[] addOrReplaceData) - { - var data = DiffCore(memory.QuestMasterTable.GetRawDataUnsafe(), addOrReplaceData, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var table = new QuestMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - table, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var table = new QuestMasterEmptyValidateTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - table, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveQuestMasterEmptyValidate(int[] keys) - { - var data = RemoveCore(memory.QuestMasterEmptyValidateTable.GetRawDataUnsafe(), keys, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var table = new QuestMasterEmptyValidateTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - table, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(QuestMasterEmptyValidate[] addOrReplaceData) - { - var data = DiffCore(memory.QuestMasterEmptyValidateTable.GetRawDataUnsafe(), addOrReplaceData, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.QuestId, System.Collections.Generic.Comparer.Default); - var table = new QuestMasterEmptyValidateTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - table, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SampleTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - table, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveSample(int[] keys) - { - var data = RemoveCore(memory.SampleTable.GetRawDataUnsafe(), keys, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SampleTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - table, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(Sample[] addOrReplaceData) - { - var data = DiffCore(memory.SampleTable.GetRawDataUnsafe(), addOrReplaceData, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SampleTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - table, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SequentialCheckMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - table, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveSequentialCheckMaster(int[] keys) - { - var data = RemoveCore(memory.SequentialCheckMasterTable.GetRawDataUnsafe(), keys, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SequentialCheckMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - table, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(SequentialCheckMaster[] addOrReplaceData) - { - var data = DiffCore(memory.SequentialCheckMasterTable.GetRawDataUnsafe(), addOrReplaceData, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SequentialCheckMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - table, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SingleMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - table, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveSingleMaster(int[] keys) - { - var data = RemoveCore(memory.SingleMasterTable.GetRawDataUnsafe(), keys, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SingleMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - table, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(SingleMaster[] addOrReplaceData) - { - var data = DiffCore(memory.SingleMasterTable.GetRawDataUnsafe(), addOrReplaceData, x => x.Id, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Id, System.Collections.Generic.Comparer.Default); - var table = new SingleMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - table, - memory.SkillMasterTable, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => (x.SkillId, x.SkillLevel), System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default); - var table = new SkillMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - table, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void RemoveSkillMaster((int SkillId, int SkillLevel)[] keys) - { - var data = RemoveCore(memory.SkillMasterTable.GetRawDataUnsafe(), keys, x => (x.SkillId, x.SkillLevel), System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default); - var newData = CloneAndSortBy(data, x => (x.SkillId, x.SkillLevel), System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default); - var table = new SkillMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - table, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void Diff(SkillMaster[] addOrReplaceData) - { - var data = DiffCore(memory.SkillMasterTable.GetRawDataUnsafe(), addOrReplaceData, x => (x.SkillId, x.SkillLevel), System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default); - var newData = CloneAndSortBy(data, x => (x.SkillId, x.SkillLevel), System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default); - var table = new SkillMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - table, - memory.TestMasterTable, - memory.UserLevelTable - - ); - } - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.TestID, System.Collections.Generic.Comparer.Default); - var table = new TestMasterTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - table, - memory.UserLevelTable - - ); - } - - - public void ReplaceAll(System.Collections.Generic.IList data) - { - var newData = CloneAndSortBy(data, x => x.Level, System.Collections.Generic.Comparer.Default); - var table = new UserLevelTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - table - - ); - } - - public void RemoveUserLevel(int[] keys) - { - var data = RemoveCore(memory.UserLevelTable.GetRawDataUnsafe(), keys, x => x.Level, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Level, System.Collections.Generic.Comparer.Default); - var table = new UserLevelTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - table - - ); - } - - public void Diff(UserLevel[] addOrReplaceData) - { - var data = DiffCore(memory.UserLevelTable.GetRawDataUnsafe(), addOrReplaceData, x => x.Level, System.Collections.Generic.Comparer.Default); - var newData = CloneAndSortBy(data, x => x.Level, System.Collections.Generic.Comparer.Default); - var table = new UserLevelTable(newData); - memory = new MemoryDatabase( - memory.FailTable, - memory.ItemMasterTable, - memory.ItemMasterEmptyValidateTable, - memory.PersonModelTable, - memory.QuestMasterTable, - memory.QuestMasterEmptyValidateTable, - memory.SampleTable, - memory.SequentialCheckMasterTable, - memory.SingleMasterTable, - memory.SkillMasterTable, - memory.TestMasterTable, - table - - ); - } - - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/MasterMemoryResolver.cs b/tests/MasterMemory.Tests/Generated/MasterMemoryResolver.cs deleted file mode 100644 index 55e64aca..00000000 --- a/tests/MasterMemory.Tests/Generated/MasterMemoryResolver.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; -using MasterMemory.Tests.Tables; - -namespace MasterMemory.Tests -{ - public class MasterMemoryResolver : global::MessagePack.IFormatterResolver - { - public static readonly global::MessagePack.IFormatterResolver Instance = new MasterMemoryResolver(); - - MasterMemoryResolver() - { - - } - - public global::MessagePack.Formatters.IMessagePackFormatter GetFormatter() - { - return FormatterCache.formatter; - } - - static class FormatterCache - { - public static readonly global::MessagePack.Formatters.IMessagePackFormatter formatter; - - static FormatterCache() - { - var f = MasterMemoryResolverGetFormatterHelper.GetFormatter(typeof(T)); - if (f != null) - { - formatter = (global::MessagePack.Formatters.IMessagePackFormatter)f; - } - } - } - } - - internal static class MasterMemoryResolverGetFormatterHelper - { - static readonly global::System.Collections.Generic.Dictionary lookup; - - static MasterMemoryResolverGetFormatterHelper() - { - lookup = new global::System.Collections.Generic.Dictionary(12) - { - {typeof(Fail[]), 0 }, - {typeof(ItemMaster[]), 1 }, - {typeof(ItemMasterEmptyValidate[]), 2 }, - {typeof(PersonModel[]), 3 }, - {typeof(QuestMaster[]), 4 }, - {typeof(QuestMasterEmptyValidate[]), 5 }, - {typeof(Sample[]), 6 }, - {typeof(SequentialCheckMaster[]), 7 }, - {typeof(SingleMaster[]), 8 }, - {typeof(SkillMaster[]), 9 }, - {typeof(TestMaster[]), 10 }, - {typeof(UserLevel[]), 11 }, - }; - } - - internal static object GetFormatter(Type t) - { - int key; - if (!lookup.TryGetValue(t, out key)) return null; - - switch (key) - { - case 0: return new MessagePack.Formatters.ArrayFormatter(); - case 1: return new MessagePack.Formatters.ArrayFormatter(); - case 2: return new MessagePack.Formatters.ArrayFormatter(); - case 3: return new MessagePack.Formatters.ArrayFormatter(); - case 4: return new MessagePack.Formatters.ArrayFormatter(); - case 5: return new MessagePack.Formatters.ArrayFormatter(); - case 6: return new MessagePack.Formatters.ArrayFormatter(); - case 7: return new MessagePack.Formatters.ArrayFormatter(); - case 8: return new MessagePack.Formatters.ArrayFormatter(); - case 9: return new MessagePack.Formatters.ArrayFormatter(); - case 10: return new MessagePack.Formatters.ArrayFormatter(); - case 11: return new MessagePack.Formatters.ArrayFormatter(); - default: return null; - } - } - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/MemoryDatabase.cs b/tests/MasterMemory.Tests/Generated/MemoryDatabase.cs deleted file mode 100644 index 657a88d2..00000000 --- a/tests/MasterMemory.Tests/Generated/MemoryDatabase.cs +++ /dev/null @@ -1,270 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; -using MasterMemory.Tests.Tables; - -namespace MasterMemory.Tests -{ - public sealed class MemoryDatabase : MemoryDatabaseBase - { - public FailTable FailTable { get; private set; } - public ItemMasterTable ItemMasterTable { get; private set; } - public ItemMasterEmptyValidateTable ItemMasterEmptyValidateTable { get; private set; } - public PersonModelTable PersonModelTable { get; private set; } - public QuestMasterTable QuestMasterTable { get; private set; } - public QuestMasterEmptyValidateTable QuestMasterEmptyValidateTable { get; private set; } - public SampleTable SampleTable { get; private set; } - public SequentialCheckMasterTable SequentialCheckMasterTable { get; private set; } - public SingleMasterTable SingleMasterTable { get; private set; } - public SkillMasterTable SkillMasterTable { get; private set; } - public TestMasterTable TestMasterTable { get; private set; } - public UserLevelTable UserLevelTable { get; private set; } - - public MemoryDatabase( - FailTable FailTable, - ItemMasterTable ItemMasterTable, - ItemMasterEmptyValidateTable ItemMasterEmptyValidateTable, - PersonModelTable PersonModelTable, - QuestMasterTable QuestMasterTable, - QuestMasterEmptyValidateTable QuestMasterEmptyValidateTable, - SampleTable SampleTable, - SequentialCheckMasterTable SequentialCheckMasterTable, - SingleMasterTable SingleMasterTable, - SkillMasterTable SkillMasterTable, - TestMasterTable TestMasterTable, - UserLevelTable UserLevelTable - ) - { - this.FailTable = FailTable; - this.ItemMasterTable = ItemMasterTable; - this.ItemMasterEmptyValidateTable = ItemMasterEmptyValidateTable; - this.PersonModelTable = PersonModelTable; - this.QuestMasterTable = QuestMasterTable; - this.QuestMasterEmptyValidateTable = QuestMasterEmptyValidateTable; - this.SampleTable = SampleTable; - this.SequentialCheckMasterTable = SequentialCheckMasterTable; - this.SingleMasterTable = SingleMasterTable; - this.SkillMasterTable = SkillMasterTable; - this.TestMasterTable = TestMasterTable; - this.UserLevelTable = UserLevelTable; - } - - public MemoryDatabase(byte[] databaseBinary, bool internString = true, MessagePack.IFormatterResolver formatterResolver = null, int maxDegreeOfParallelism = 1) - : base(databaseBinary, internString, formatterResolver, maxDegreeOfParallelism) - { - } - - protected override void Init(Dictionary header, System.ReadOnlyMemory databaseBinary, MessagePack.MessagePackSerializerOptions options, int maxDegreeOfParallelism) - { - if(maxDegreeOfParallelism == 1) - { - InitSequential(header, databaseBinary, options, maxDegreeOfParallelism); - } - else - { - InitParallel(header, databaseBinary, options, maxDegreeOfParallelism); - } - } - - void InitSequential(Dictionary header, System.ReadOnlyMemory databaseBinary, MessagePack.MessagePackSerializerOptions options, int maxDegreeOfParallelism) - { - this.FailTable = ExtractTableData(header, databaseBinary, options, xs => new FailTable(xs)); - this.ItemMasterTable = ExtractTableData(header, databaseBinary, options, xs => new ItemMasterTable(xs)); - this.ItemMasterEmptyValidateTable = ExtractTableData(header, databaseBinary, options, xs => new ItemMasterEmptyValidateTable(xs)); - this.PersonModelTable = ExtractTableData(header, databaseBinary, options, xs => new PersonModelTable(xs)); - this.QuestMasterTable = ExtractTableData(header, databaseBinary, options, xs => new QuestMasterTable(xs)); - this.QuestMasterEmptyValidateTable = ExtractTableData(header, databaseBinary, options, xs => new QuestMasterEmptyValidateTable(xs)); - this.SampleTable = ExtractTableData(header, databaseBinary, options, xs => new SampleTable(xs)); - this.SequentialCheckMasterTable = ExtractTableData(header, databaseBinary, options, xs => new SequentialCheckMasterTable(xs)); - this.SingleMasterTable = ExtractTableData(header, databaseBinary, options, xs => new SingleMasterTable(xs)); - this.SkillMasterTable = ExtractTableData(header, databaseBinary, options, xs => new SkillMasterTable(xs)); - this.TestMasterTable = ExtractTableData(header, databaseBinary, options, xs => new TestMasterTable(xs)); - this.UserLevelTable = ExtractTableData(header, databaseBinary, options, xs => new UserLevelTable(xs)); - } - - void InitParallel(Dictionary header, System.ReadOnlyMemory databaseBinary, MessagePack.MessagePackSerializerOptions options, int maxDegreeOfParallelism) - { - var extracts = new Action[] - { - () => this.FailTable = ExtractTableData(header, databaseBinary, options, xs => new FailTable(xs)), - () => this.ItemMasterTable = ExtractTableData(header, databaseBinary, options, xs => new ItemMasterTable(xs)), - () => this.ItemMasterEmptyValidateTable = ExtractTableData(header, databaseBinary, options, xs => new ItemMasterEmptyValidateTable(xs)), - () => this.PersonModelTable = ExtractTableData(header, databaseBinary, options, xs => new PersonModelTable(xs)), - () => this.QuestMasterTable = ExtractTableData(header, databaseBinary, options, xs => new QuestMasterTable(xs)), - () => this.QuestMasterEmptyValidateTable = ExtractTableData(header, databaseBinary, options, xs => new QuestMasterEmptyValidateTable(xs)), - () => this.SampleTable = ExtractTableData(header, databaseBinary, options, xs => new SampleTable(xs)), - () => this.SequentialCheckMasterTable = ExtractTableData(header, databaseBinary, options, xs => new SequentialCheckMasterTable(xs)), - () => this.SingleMasterTable = ExtractTableData(header, databaseBinary, options, xs => new SingleMasterTable(xs)), - () => this.SkillMasterTable = ExtractTableData(header, databaseBinary, options, xs => new SkillMasterTable(xs)), - () => this.TestMasterTable = ExtractTableData(header, databaseBinary, options, xs => new TestMasterTable(xs)), - () => this.UserLevelTable = ExtractTableData(header, databaseBinary, options, xs => new UserLevelTable(xs)), - }; - - System.Threading.Tasks.Parallel.ForEach(extracts, new System.Threading.Tasks.ParallelOptions - { - MaxDegreeOfParallelism = maxDegreeOfParallelism - }, action => action.Invoke()); - } - - public ImmutableBuilder ToImmutableBuilder() - { - return new ImmutableBuilder(this); - } - - public DatabaseBuilder ToDatabaseBuilder() - { - var builder = new DatabaseBuilder(); - builder.Append(this.FailTable.GetRawDataUnsafe()); - builder.Append(this.ItemMasterTable.GetRawDataUnsafe()); - builder.Append(this.ItemMasterEmptyValidateTable.GetRawDataUnsafe()); - builder.Append(this.PersonModelTable.GetRawDataUnsafe()); - builder.Append(this.QuestMasterTable.GetRawDataUnsafe()); - builder.Append(this.QuestMasterEmptyValidateTable.GetRawDataUnsafe()); - builder.Append(this.SampleTable.GetRawDataUnsafe()); - builder.Append(this.SequentialCheckMasterTable.GetRawDataUnsafe()); - builder.Append(this.SingleMasterTable.GetRawDataUnsafe()); - builder.Append(this.SkillMasterTable.GetRawDataUnsafe()); - builder.Append(this.TestMasterTable.GetRawDataUnsafe()); - builder.Append(this.UserLevelTable.GetRawDataUnsafe()); - return builder; - } - - public DatabaseBuilder ToDatabaseBuilder(MessagePack.IFormatterResolver resolver) - { - var builder = new DatabaseBuilder(resolver); - builder.Append(this.FailTable.GetRawDataUnsafe()); - builder.Append(this.ItemMasterTable.GetRawDataUnsafe()); - builder.Append(this.ItemMasterEmptyValidateTable.GetRawDataUnsafe()); - builder.Append(this.PersonModelTable.GetRawDataUnsafe()); - builder.Append(this.QuestMasterTable.GetRawDataUnsafe()); - builder.Append(this.QuestMasterEmptyValidateTable.GetRawDataUnsafe()); - builder.Append(this.SampleTable.GetRawDataUnsafe()); - builder.Append(this.SequentialCheckMasterTable.GetRawDataUnsafe()); - builder.Append(this.SingleMasterTable.GetRawDataUnsafe()); - builder.Append(this.SkillMasterTable.GetRawDataUnsafe()); - builder.Append(this.TestMasterTable.GetRawDataUnsafe()); - builder.Append(this.UserLevelTable.GetRawDataUnsafe()); - return builder; - } - -#if !DISABLE_MASTERMEMORY_VALIDATOR - - public ValidateResult Validate() - { - var result = new ValidateResult(); - var database = new ValidationDatabase(new object[] - { - FailTable, - ItemMasterTable, - ItemMasterEmptyValidateTable, - PersonModelTable, - QuestMasterTable, - QuestMasterEmptyValidateTable, - SampleTable, - SequentialCheckMasterTable, - SingleMasterTable, - SkillMasterTable, - TestMasterTable, - UserLevelTable, - }); - - ((ITableUniqueValidate)FailTable).ValidateUnique(result); - ValidateTable(FailTable.All, database, "Id", FailTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)ItemMasterTable).ValidateUnique(result); - ValidateTable(ItemMasterTable.All, database, "ItemId", ItemMasterTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)ItemMasterEmptyValidateTable).ValidateUnique(result); - ValidateTable(ItemMasterEmptyValidateTable.All, database, "ItemId", ItemMasterEmptyValidateTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)PersonModelTable).ValidateUnique(result); - ValidateTable(PersonModelTable.All, database, "RandomId", PersonModelTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)QuestMasterTable).ValidateUnique(result); - ValidateTable(QuestMasterTable.All, database, "QuestId", QuestMasterTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)QuestMasterEmptyValidateTable).ValidateUnique(result); - ValidateTable(QuestMasterEmptyValidateTable.All, database, "QuestId", QuestMasterEmptyValidateTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)SampleTable).ValidateUnique(result); - ValidateTable(SampleTable.All, database, "Id", SampleTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)SequentialCheckMasterTable).ValidateUnique(result); - ValidateTable(SequentialCheckMasterTable.All, database, "Id", SequentialCheckMasterTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)SingleMasterTable).ValidateUnique(result); - ValidateTable(SingleMasterTable.All, database, "Id", SingleMasterTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)SkillMasterTable).ValidateUnique(result); - ValidateTable(SkillMasterTable.All, database, "(SkillId, SkillLevel)", SkillMasterTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)TestMasterTable).ValidateUnique(result); - ValidateTable(TestMasterTable.All, database, "TestID", TestMasterTable.PrimaryKeySelector, result); - ((ITableUniqueValidate)UserLevelTable).ValidateUnique(result); - ValidateTable(UserLevelTable.All, database, "Level", UserLevelTable.PrimaryKeySelector, result); - - return result; - } - -#endif - - static MasterMemory.Meta.MetaDatabase metaTable; - - public static object GetTable(MemoryDatabase db, string tableName) - { - switch (tableName) - { - case "fail": - return db.FailTable; - case "item_master": - return db.ItemMasterTable; - case "item_master_empty": - return db.ItemMasterEmptyValidateTable; - case "people": - return db.PersonModelTable; - case "quest_master": - return db.QuestMasterTable; - case "quest_master_empty": - return db.QuestMasterEmptyValidateTable; - case "s_a_m_p_l_e": - return db.SampleTable; - case "sequantial_master": - return db.SequentialCheckMasterTable; - case "single_master": - return db.SingleMasterTable; - case "skillmaster": - return db.SkillMasterTable; - case "TestMaster": - return db.TestMasterTable; - case "UserLevel": - return db.UserLevelTable; - - default: - return null; - } - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaDatabase GetMetaDatabase() - { - if (metaTable != null) return metaTable; - - var dict = new Dictionary(); - dict.Add("fail", MasterMemory.Tests.Tables.FailTable.CreateMetaTable()); - dict.Add("item_master", MasterMemory.Tests.Tables.ItemMasterTable.CreateMetaTable()); - dict.Add("item_master_empty", MasterMemory.Tests.Tables.ItemMasterEmptyValidateTable.CreateMetaTable()); - dict.Add("people", MasterMemory.Tests.Tables.PersonModelTable.CreateMetaTable()); - dict.Add("quest_master", MasterMemory.Tests.Tables.QuestMasterTable.CreateMetaTable()); - dict.Add("quest_master_empty", MasterMemory.Tests.Tables.QuestMasterEmptyValidateTable.CreateMetaTable()); - dict.Add("s_a_m_p_l_e", MasterMemory.Tests.Tables.SampleTable.CreateMetaTable()); - dict.Add("sequantial_master", MasterMemory.Tests.Tables.SequentialCheckMasterTable.CreateMetaTable()); - dict.Add("single_master", MasterMemory.Tests.Tables.SingleMasterTable.CreateMetaTable()); - dict.Add("skillmaster", MasterMemory.Tests.Tables.SkillMasterTable.CreateMetaTable()); - dict.Add("TestMaster", MasterMemory.Tests.Tables.TestMasterTable.CreateMetaTable()); - dict.Add("UserLevel", MasterMemory.Tests.Tables.UserLevelTable.CreateMetaTable()); - - metaTable = new MasterMemory.Meta.MetaDatabase(dict); - return metaTable; - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/MessagePackGenerated.cs b/tests/MasterMemory.Tests/Generated/MessagePackGenerated.cs deleted file mode 100644 index b871bbd2..00000000 --- a/tests/MasterMemory.Tests/Generated/MessagePackGenerated.cs +++ /dev/null @@ -1,1114 +0,0 @@ -// -// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. -// - -#pragma warning disable 618 -#pragma warning disable 612 -#pragma warning disable 414 -#pragma warning disable 168 - -#pragma warning disable SA1200 // Using directives should be placed correctly -#pragma warning disable SA1312 // Variable names should begin with lower-case letter -#pragma warning disable SA1649 // File name should match first type name - -namespace MessagePack.Resolvers -{ - using System; - using System.Buffers; - using MessagePack; - - public class GeneratedResolver : global::MessagePack.IFormatterResolver - { - public static readonly global::MessagePack.IFormatterResolver Instance = new GeneratedResolver(); - - private GeneratedResolver() - { - } - - public global::MessagePack.Formatters.IMessagePackFormatter GetFormatter() - { - return FormatterCache.Formatter; - } - - private static class FormatterCache - { - internal static readonly global::MessagePack.Formatters.IMessagePackFormatter Formatter; - - static FormatterCache() - { - var f = GeneratedResolverGetFormatterHelper.GetFormatter(typeof(T)); - if (f != null) - { - Formatter = (global::MessagePack.Formatters.IMessagePackFormatter)f; - } - } - } - } - - internal static class GeneratedResolverGetFormatterHelper - { - private static readonly global::System.Collections.Generic.Dictionary lookup; - - static GeneratedResolverGetFormatterHelper() - { - lookup = new global::System.Collections.Generic.Dictionary(11) - { - { typeof(global::MasterMemory.Tests.TestStructures.QuestMaster), 0 }, - { typeof(global::MasterMemory.Tests.TestStructures.ItemMaster), 1 }, - { typeof(global::MasterMemory.Tests.TestStructures.QuestMasterEmptyValidate), 2 }, - { typeof(global::MasterMemory.Tests.TestStructures.ItemMasterEmptyValidate), 3 }, - { typeof(global::MasterMemory.Tests.TestStructures.SequentialCheckMaster), 4 }, - { typeof(global::MasterMemory.Tests.TestStructures.SingleMaster), 5 }, - { typeof(global::MasterMemory.Tests.TestStructures.Fail), 6 }, - { typeof(global::MasterMemory.Tests.Sample), 7 }, - { typeof(global::MasterMemory.Tests.SkillMaster), 8 }, - { typeof(global::MasterMemory.Tests.TestStructures.TestMaster), 9 }, - { typeof(global::MasterMemory.Tests.UserLevel), 10 }, - }; - } - - internal static object GetFormatter(Type t) - { - int key; - if (!lookup.TryGetValue(t, out key)) - { - return null; - } - - switch (key) - { - case 0: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.QuestMasterFormatter(); - case 1: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.ItemMasterFormatter(); - case 2: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.QuestMasterEmptyValidateFormatter(); - case 3: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.ItemMasterEmptyValidateFormatter(); - case 4: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.SequentialCheckMasterFormatter(); - case 5: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.SingleMasterFormatter(); - case 6: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.FailFormatter(); - case 7: return new MessagePack.Formatters.MasterMemory.Tests.SampleFormatter(); - case 8: return new MessagePack.Formatters.MasterMemory.Tests.SkillMasterFormatter(); - case 9: return new MessagePack.Formatters.MasterMemory.Tests.TestStructures.TestMasterFormatter(); - case 10: return new MessagePack.Formatters.MasterMemory.Tests.UserLevelFormatter(); - default: return null; - } - } - } -} - -#pragma warning restore 168 -#pragma warning restore 414 -#pragma warning restore 618 -#pragma warning restore 612 - -#pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1200 // Using directives should be placed correctly -#pragma warning restore SA1649 // File name should match first type name - - - - -// -// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. -// - -#pragma warning disable 618 -#pragma warning disable 612 -#pragma warning disable 414 -#pragma warning disable 168 - -#pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly -#pragma warning disable SA1309 // Field names should not begin with underscore -#pragma warning disable SA1312 // Variable names should begin with lower-case letter -#pragma warning disable SA1403 // File may only contain a single namespace -#pragma warning disable SA1649 // File name should match first type name - -namespace MessagePack.Formatters.MasterMemory.Tests.TestStructures -{ - using System; - using System.Buffers; - using MessagePack; - - public sealed class QuestMasterFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public QuestMasterFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "QuestId", 0 }, - { "Name", 1 }, - { "RewardItemId", 2 }, - { "Cost", 3 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("QuestId"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Name"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("RewardItemId"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Cost"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.QuestMaster value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(4); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.QuestId); - writer.WriteRaw(this.____stringByteKeys[1]); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Name, options); - writer.WriteRaw(this.____stringByteKeys[2]); - writer.Write(value.RewardItemId); - writer.WriteRaw(this.____stringByteKeys[3]); - writer.Write(value.Cost); - } - - public global::MasterMemory.Tests.TestStructures.QuestMaster Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __QuestId__ = default(int); - var __Name__ = default(string); - var __RewardItemId__ = default(int); - var __Cost__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __QuestId__ = reader.ReadInt32(); - break; - case 1: - __Name__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); - break; - case 2: - __RewardItemId__ = reader.ReadInt32(); - break; - case 3: - __Cost__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.QuestMaster(); - ____result.QuestId = __QuestId__; - ____result.Name = __Name__; - ____result.RewardItemId = __RewardItemId__; - ____result.Cost = __Cost__; - return ____result; - } - } - - public sealed class ItemMasterFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public ItemMasterFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "ItemId", 0 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("ItemId"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.ItemMaster value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(1); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.ItemId); - } - - public global::MasterMemory.Tests.TestStructures.ItemMaster Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __ItemId__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __ItemId__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.ItemMaster(); - ____result.ItemId = __ItemId__; - return ____result; - } - } - - public sealed class QuestMasterEmptyValidateFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public QuestMasterEmptyValidateFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "QuestId", 0 }, - { "Name", 1 }, - { "RewardItemId", 2 }, - { "Cost", 3 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("QuestId"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Name"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("RewardItemId"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Cost"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.QuestMasterEmptyValidate value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(4); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.QuestId); - writer.WriteRaw(this.____stringByteKeys[1]); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Name, options); - writer.WriteRaw(this.____stringByteKeys[2]); - writer.Write(value.RewardItemId); - writer.WriteRaw(this.____stringByteKeys[3]); - writer.Write(value.Cost); - } - - public global::MasterMemory.Tests.TestStructures.QuestMasterEmptyValidate Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __QuestId__ = default(int); - var __Name__ = default(string); - var __RewardItemId__ = default(int); - var __Cost__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __QuestId__ = reader.ReadInt32(); - break; - case 1: - __Name__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); - break; - case 2: - __RewardItemId__ = reader.ReadInt32(); - break; - case 3: - __Cost__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.QuestMasterEmptyValidate(); - ____result.QuestId = __QuestId__; - ____result.Name = __Name__; - ____result.RewardItemId = __RewardItemId__; - ____result.Cost = __Cost__; - return ____result; - } - } - - public sealed class ItemMasterEmptyValidateFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public ItemMasterEmptyValidateFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "ItemId", 0 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("ItemId"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.ItemMasterEmptyValidate value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(1); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.ItemId); - } - - public global::MasterMemory.Tests.TestStructures.ItemMasterEmptyValidate Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __ItemId__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __ItemId__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.ItemMasterEmptyValidate(); - ____result.ItemId = __ItemId__; - return ____result; - } - } - - public sealed class SequentialCheckMasterFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public SequentialCheckMasterFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "Id", 0 }, - { "Cost", 1 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Id"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Cost"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.SequentialCheckMaster value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(2); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.Id); - writer.WriteRaw(this.____stringByteKeys[1]); - writer.Write(value.Cost); - } - - public global::MasterMemory.Tests.TestStructures.SequentialCheckMaster Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __Id__ = default(int); - var __Cost__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __Id__ = reader.ReadInt32(); - break; - case 1: - __Cost__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.SequentialCheckMaster(); - ____result.Id = __Id__; - ____result.Cost = __Cost__; - return ____result; - } - } - - public sealed class SingleMasterFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public SingleMasterFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "Id", 0 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Id"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.SingleMaster value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(1); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.Id); - } - - public global::MasterMemory.Tests.TestStructures.SingleMaster Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __Id__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __Id__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.SingleMaster(); - ____result.Id = __Id__; - return ____result; - } - } - - public sealed class FailFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public FailFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "Id", 0 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Id"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.Fail value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(1); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.Id); - } - - public global::MasterMemory.Tests.TestStructures.Fail Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __Id__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __Id__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.Fail(); - ____result.Id = __Id__; - return ____result; - } - } - - public sealed class TestMasterFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public TestMasterFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "TestID", 0 }, - { "Value", 1 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("TestID"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Value"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.TestStructures.TestMaster value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(2); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.TestID); - writer.WriteRaw(this.____stringByteKeys[1]); - writer.Write(value.Value); - } - - public global::MasterMemory.Tests.TestStructures.TestMaster Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __TestID__ = default(int); - var __Value__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __TestID__ = reader.ReadInt32(); - break; - case 1: - __Value__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.TestStructures.TestMaster(__TestID__, __Value__); - ____result.TestID = __TestID__; - ____result.Value = __Value__; - return ____result; - } - } -} - -#pragma warning restore 168 -#pragma warning restore 414 -#pragma warning restore 618 -#pragma warning restore 612 - -#pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly -#pragma warning restore SA1309 // Field names should not begin with underscore -#pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1403 // File may only contain a single namespace -#pragma warning restore SA1649 // File name should match first type name - -// -// THIS (.cs) FILE IS GENERATED BY MPC(MessagePack-CSharp). DO NOT CHANGE IT. -// - -#pragma warning disable 618 -#pragma warning disable 612 -#pragma warning disable 414 -#pragma warning disable 168 - -#pragma warning disable SA1129 // Do not use default value type constructor -#pragma warning disable SA1200 // Using directives should be placed correctly -#pragma warning disable SA1309 // Field names should not begin with underscore -#pragma warning disable SA1312 // Variable names should begin with lower-case letter -#pragma warning disable SA1403 // File may only contain a single namespace -#pragma warning disable SA1649 // File name should match first type name - -namespace MessagePack.Formatters.MasterMemory.Tests -{ - using System; - using System.Buffers; - using MessagePack; - - public sealed class SampleFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public SampleFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "Id", 0 }, - { "Age", 1 }, - { "FirstName", 2 }, - { "LastName", 3 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Id"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Age"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("FirstName"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("LastName"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.Sample value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(4); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.Id); - writer.WriteRaw(this.____stringByteKeys[1]); - writer.Write(value.Age); - writer.WriteRaw(this.____stringByteKeys[2]); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.FirstName, options); - writer.WriteRaw(this.____stringByteKeys[3]); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.LastName, options); - } - - public global::MasterMemory.Tests.Sample Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __Id__ = default(int); - var __Age__ = default(int); - var __FirstName__ = default(string); - var __LastName__ = default(string); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __Id__ = reader.ReadInt32(); - break; - case 1: - __Age__ = reader.ReadInt32(); - break; - case 2: - __FirstName__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); - break; - case 3: - __LastName__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.Sample(__Id__, __Age__, __FirstName__, __LastName__); - ____result.Id = __Id__; - ____result.Age = __Age__; - ____result.FirstName = __FirstName__; - ____result.LastName = __LastName__; - return ____result; - } - } - - public sealed class SkillMasterFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public SkillMasterFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "SkillId", 0 }, - { "SkillLevel", 1 }, - { "AttackPower", 2 }, - { "SkillName", 3 }, - { "Description", 4 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("SkillId"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("SkillLevel"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("AttackPower"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("SkillName"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Description"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.SkillMaster value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(5); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.SkillId); - writer.WriteRaw(this.____stringByteKeys[1]); - writer.Write(value.SkillLevel); - writer.WriteRaw(this.____stringByteKeys[2]); - writer.Write(value.AttackPower); - writer.WriteRaw(this.____stringByteKeys[3]); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.SkillName, options); - writer.WriteRaw(this.____stringByteKeys[4]); - formatterResolver.GetFormatterWithVerify().Serialize(ref writer, value.Description, options); - } - - public global::MasterMemory.Tests.SkillMaster Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __SkillId__ = default(int); - var __SkillLevel__ = default(int); - var __AttackPower__ = default(int); - var __SkillName__ = default(string); - var __Description__ = default(string); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __SkillId__ = reader.ReadInt32(); - break; - case 1: - __SkillLevel__ = reader.ReadInt32(); - break; - case 2: - __AttackPower__ = reader.ReadInt32(); - break; - case 3: - __SkillName__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); - break; - case 4: - __Description__ = formatterResolver.GetFormatterWithVerify().Deserialize(ref reader, options); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.SkillMaster(__SkillId__, __SkillLevel__, __AttackPower__, __SkillName__, __Description__); - ____result.SkillId = __SkillId__; - ____result.SkillLevel = __SkillLevel__; - ____result.AttackPower = __AttackPower__; - ____result.SkillName = __SkillName__; - ____result.Description = __Description__; - return ____result; - } - } - - public sealed class UserLevelFormatter : global::MessagePack.Formatters.IMessagePackFormatter - { - - - private readonly global::MessagePack.Internal.AutomataDictionary ____keyMapping; - private readonly byte[][] ____stringByteKeys; - - public UserLevelFormatter() - { - this.____keyMapping = new global::MessagePack.Internal.AutomataDictionary() - { - { "Level", 0 }, - { "Exp", 1 }, - }; - - this.____stringByteKeys = new byte[][] - { - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Level"), - global::MessagePack.Internal.CodeGenHelpers.GetEncodedStringBytes("Exp"), - }; - } - - public void Serialize(ref MessagePackWriter writer, global::MasterMemory.Tests.UserLevel value, global::MessagePack.MessagePackSerializerOptions options) - { - if (value == null) - { - writer.WriteNil(); - return; - } - - IFormatterResolver formatterResolver = options.Resolver; - writer.WriteMapHeader(2); - writer.WriteRaw(this.____stringByteKeys[0]); - writer.Write(value.Level); - writer.WriteRaw(this.____stringByteKeys[1]); - writer.Write(value.Exp); - } - - public global::MasterMemory.Tests.UserLevel Deserialize(ref MessagePackReader reader, global::MessagePack.MessagePackSerializerOptions options) - { - if (reader.TryReadNil()) - { - return null; - } - - IFormatterResolver formatterResolver = options.Resolver; - var length = reader.ReadMapHeader(); - var __Level__ = default(int); - var __Exp__ = default(int); - - for (int i = 0; i < length; i++) - { - ReadOnlySpan stringKey = Internal.CodeGenHelpers.ReadStringSpan(ref reader); - int key; - if (!this.____keyMapping.TryGetValue(stringKey, out key)) - { - reader.Skip(); - continue; - } - - switch (key) - { - case 0: - __Level__ = reader.ReadInt32(); - break; - case 1: - __Exp__ = reader.ReadInt32(); - break; - default: - reader.Skip(); - break; - } - } - - var ____result = new global::MasterMemory.Tests.UserLevel(__Level__, __Exp__); - ____result.Level = __Level__; - ____result.Exp = __Exp__; - return ____result; - } - } -} - -#pragma warning restore 168 -#pragma warning restore 414 -#pragma warning restore 618 -#pragma warning restore 612 - -#pragma warning restore SA1129 // Do not use default value type constructor -#pragma warning restore SA1200 // Using directives should be placed correctly -#pragma warning restore SA1309 // Field names should not begin with underscore -#pragma warning restore SA1312 // Variable names should begin with lower-case letter -#pragma warning restore SA1403 // File may only contain a single namespace -#pragma warning restore SA1649 // File name should match first type name - diff --git a/tests/MasterMemory.Tests/Generated/Tables/FailTable.cs b/tests/MasterMemory.Tests/Generated/Tables/FailTable.cs deleted file mode 100644 index 7694e062..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/FailTable.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class FailTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public FailTable(Fail[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.Id; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public Fail FindById(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindById(int key, out Fail result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public Fail FindClosestById(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeById(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "Id", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(Fail), typeof(FailTable), "fail", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(Fail).GetProperty("Id")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Fail).GetProperty("Id"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/ItemMasterEmptyValidateTable.cs b/tests/MasterMemory.Tests/Generated/Tables/ItemMasterEmptyValidateTable.cs deleted file mode 100644 index eae39e3f..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/ItemMasterEmptyValidateTable.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class ItemMasterEmptyValidateTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public ItemMasterEmptyValidateTable(ItemMasterEmptyValidate[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.ItemId; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public ItemMasterEmptyValidate FindByItemId(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].ItemId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindByItemId(int key, out ItemMasterEmptyValidate result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].ItemId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public ItemMasterEmptyValidate FindClosestByItemId(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByItemId(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "ItemId", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(ItemMasterEmptyValidate), typeof(ItemMasterEmptyValidateTable), "item_master_empty", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(ItemMasterEmptyValidate).GetProperty("ItemId")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(ItemMasterEmptyValidate).GetProperty("ItemId"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/ItemMasterTable.cs b/tests/MasterMemory.Tests/Generated/Tables/ItemMasterTable.cs deleted file mode 100644 index 332cfdbf..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/ItemMasterTable.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class ItemMasterTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public ItemMasterTable(ItemMaster[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.ItemId; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public ItemMaster FindByItemId(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].ItemId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindByItemId(int key, out ItemMaster result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].ItemId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public ItemMaster FindClosestByItemId(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByItemId(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "ItemId", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(ItemMaster), typeof(ItemMasterTable), "item_master", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(ItemMaster).GetProperty("ItemId")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(ItemMaster).GetProperty("ItemId"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/PersonModelTable.cs b/tests/MasterMemory.Tests/Generated/Tables/PersonModelTable.cs deleted file mode 100644 index f35fdf0b..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/PersonModelTable.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class PersonModelTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - readonly PersonModel[] secondaryIndex0; - readonly Func secondaryIndex0Selector; - readonly PersonModel[] secondaryIndex1; - readonly Func secondaryIndex1Selector; - readonly PersonModel[] secondaryIndex2; - readonly Func secondaryIndex2Selector; - - public PersonModelTable(PersonModel[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.RandomId; - this.secondaryIndex0Selector = x => x.LastName; - this.secondaryIndex0 = CloneAndSortBy(this.secondaryIndex0Selector, System.StringComparer.Ordinal); - this.secondaryIndex1Selector = x => (x.FirstName, x.LastName); - this.secondaryIndex1 = CloneAndSortBy(this.secondaryIndex1Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default); - this.secondaryIndex2Selector = x => x.FirstName; - this.secondaryIndex2 = CloneAndSortBy(this.secondaryIndex2Selector, System.StringComparer.Ordinal); - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - public RangeView SortByLastName => new RangeView(secondaryIndex0, 0, secondaryIndex0.Length - 1, true); - public RangeView SortByFirstNameAndLastName => new RangeView(secondaryIndex1, 0, secondaryIndex1.Length - 1, true); - public RangeView SortByFirstName => new RangeView(secondaryIndex2, 0, secondaryIndex2.Length - 1, true); - - public PersonModel FindByRandomId(string key) - { - return FindUniqueCore(data, primaryIndexSelector, System.StringComparer.Ordinal, key, true); - } - - public bool TryFindByRandomId(string key, out PersonModel result) - { - return TryFindUniqueCore(data, primaryIndexSelector, System.StringComparer.Ordinal, key, out result); - } - - public PersonModel FindClosestByRandomId(string key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.StringComparer.Ordinal, key, selectLower); - } - - public RangeView FindRangeByRandomId(string min, string max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.StringComparer.Ordinal, min, max, ascendant); - } - - public RangeView FindByLastName(string key) - { - return FindManyCore(secondaryIndex0, secondaryIndex0Selector, System.StringComparer.Ordinal, key); - } - - public RangeView FindClosestByLastName(string key, bool selectLower = true) - { - return FindManyClosestCore(secondaryIndex0, secondaryIndex0Selector, System.StringComparer.Ordinal, key, selectLower); - } - - public RangeView FindRangeByLastName(string min, string max, bool ascendant = true) - { - return FindManyRangeCore(secondaryIndex0, secondaryIndex0Selector, System.StringComparer.Ordinal, min, max, ascendant); - } - - public RangeView FindByFirstNameAndLastName((string FirstName, string LastName) key) - { - return FindManyCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, key); - } - - public RangeView FindClosestByFirstNameAndLastName((string FirstName, string LastName) key, bool selectLower = true) - { - return FindManyClosestCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, key, selectLower); - } - - public RangeView FindRangeByFirstNameAndLastName((string FirstName, string LastName) min, (string FirstName, string LastName) max, bool ascendant = true) - { - return FindManyRangeCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, min, max, ascendant); - } - - public RangeView FindByFirstName(string key) - { - return FindManyCore(secondaryIndex2, secondaryIndex2Selector, System.StringComparer.Ordinal, key); - } - - public RangeView FindClosestByFirstName(string key, bool selectLower = true) - { - return FindManyClosestCore(secondaryIndex2, secondaryIndex2Selector, System.StringComparer.Ordinal, key, selectLower); - } - - public RangeView FindRangeByFirstName(string min, string max, bool ascendant = true) - { - return FindManyRangeCore(secondaryIndex2, secondaryIndex2Selector, System.StringComparer.Ordinal, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "RandomId", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(PersonModel), typeof(PersonModelTable), "people", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(PersonModel).GetProperty("LastName")), - new MasterMemory.Meta.MetaProperty(typeof(PersonModel).GetProperty("FirstName")), - new MasterMemory.Meta.MetaProperty(typeof(PersonModel).GetProperty("RandomId")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(PersonModel).GetProperty("RandomId"), - }, true, true, System.StringComparer.Ordinal), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(PersonModel).GetProperty("LastName"), - }, false, false, System.StringComparer.Ordinal), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(PersonModel).GetProperty("FirstName"), - typeof(PersonModel).GetProperty("LastName"), - }, false, false, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(PersonModel).GetProperty("FirstName"), - }, false, false, System.StringComparer.Ordinal), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/QuestMasterEmptyValidateTable.cs b/tests/MasterMemory.Tests/Generated/Tables/QuestMasterEmptyValidateTable.cs deleted file mode 100644 index 820dc71f..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/QuestMasterEmptyValidateTable.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class QuestMasterEmptyValidateTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public QuestMasterEmptyValidateTable(QuestMasterEmptyValidate[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.QuestId; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public QuestMasterEmptyValidate FindByQuestId(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].QuestId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindByQuestId(int key, out QuestMasterEmptyValidate result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].QuestId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public QuestMasterEmptyValidate FindClosestByQuestId(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByQuestId(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "QuestId", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(QuestMasterEmptyValidate), typeof(QuestMasterEmptyValidateTable), "quest_master_empty", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(QuestMasterEmptyValidate).GetProperty("QuestId")), - new MasterMemory.Meta.MetaProperty(typeof(QuestMasterEmptyValidate).GetProperty("Name")), - new MasterMemory.Meta.MetaProperty(typeof(QuestMasterEmptyValidate).GetProperty("RewardItemId")), - new MasterMemory.Meta.MetaProperty(typeof(QuestMasterEmptyValidate).GetProperty("Cost")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(QuestMasterEmptyValidate).GetProperty("QuestId"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/QuestMasterTable.cs b/tests/MasterMemory.Tests/Generated/Tables/QuestMasterTable.cs deleted file mode 100644 index 0e4d059e..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/QuestMasterTable.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class QuestMasterTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public QuestMasterTable(QuestMaster[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.QuestId; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public QuestMaster FindByQuestId(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].QuestId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindByQuestId(int key, out QuestMaster result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].QuestId; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public QuestMaster FindClosestByQuestId(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByQuestId(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "QuestId", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(QuestMaster), typeof(QuestMasterTable), "quest_master", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(QuestMaster).GetProperty("QuestId")), - new MasterMemory.Meta.MetaProperty(typeof(QuestMaster).GetProperty("Name")), - new MasterMemory.Meta.MetaProperty(typeof(QuestMaster).GetProperty("RewardItemId")), - new MasterMemory.Meta.MetaProperty(typeof(QuestMaster).GetProperty("Cost")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(QuestMaster).GetProperty("QuestId"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/SampleTable.cs b/tests/MasterMemory.Tests/Generated/Tables/SampleTable.cs deleted file mode 100644 index a1b27b89..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/SampleTable.cs +++ /dev/null @@ -1,297 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class SampleTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - readonly Sample[] secondaryIndex1; - readonly Func secondaryIndex1Selector; - readonly Sample[] secondaryIndex2; - readonly Func secondaryIndex2Selector; - readonly Sample[] secondaryIndex3; - readonly Func secondaryIndex3Selector; - readonly Sample[] secondaryIndex5; - readonly Func secondaryIndex5Selector; - readonly Sample[] secondaryIndex6; - readonly Func secondaryIndex6Selector; - readonly Sample[] secondaryIndex0; - readonly Func secondaryIndex0Selector; - readonly Sample[] secondaryIndex4; - readonly Func secondaryIndex4Selector; - - public SampleTable(Sample[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.Id; - this.secondaryIndex1Selector = x => (x.Id, x.Age, x.FirstName, x.LastName); - this.secondaryIndex1 = CloneAndSortBy(this.secondaryIndex1Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName, string LastName)>.Default); - this.secondaryIndex2Selector = x => (x.Id, x.Age); - this.secondaryIndex2 = CloneAndSortBy(this.secondaryIndex2Selector, System.Collections.Generic.Comparer<(int Id, int Age)>.Default); - this.secondaryIndex3Selector = x => (x.Id, x.Age, x.FirstName); - this.secondaryIndex3 = CloneAndSortBy(this.secondaryIndex3Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName)>.Default); - this.secondaryIndex5Selector = x => x.Age; - this.secondaryIndex5 = CloneAndSortBy(this.secondaryIndex5Selector, System.Collections.Generic.Comparer.Default); - this.secondaryIndex6Selector = x => (x.FirstName, x.Age); - this.secondaryIndex6 = CloneAndSortBy(this.secondaryIndex6Selector, System.Collections.Generic.Comparer<(string FirstName, int Age)>.Default); - this.secondaryIndex0Selector = x => (x.FirstName, x.LastName); - this.secondaryIndex0 = CloneAndSortBy(this.secondaryIndex0Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default); - this.secondaryIndex4Selector = x => x.FirstName; - this.secondaryIndex4 = CloneAndSortBy(this.secondaryIndex4Selector, System.StringComparer.Ordinal); - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - public RangeView SortByIdAndAgeAndFirstNameAndLastName => new RangeView(secondaryIndex1, 0, secondaryIndex1.Length - 1, true); - public RangeView SortByIdAndAge => new RangeView(secondaryIndex2, 0, secondaryIndex2.Length - 1, true); - public RangeView SortByIdAndAgeAndFirstName => new RangeView(secondaryIndex3, 0, secondaryIndex3.Length - 1, true); - public RangeView SortByAge => new RangeView(secondaryIndex5, 0, secondaryIndex5.Length - 1, true); - public RangeView SortByFirstNameAndAge => new RangeView(secondaryIndex6, 0, secondaryIndex6.Length - 1, true); - public RangeView SortByFirstNameAndLastName => new RangeView(secondaryIndex0, 0, secondaryIndex0.Length - 1, true); - public RangeView SortByFirstName => new RangeView(secondaryIndex4, 0, secondaryIndex4.Length - 1, true); - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public Sample FindById(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindById(int key, out Sample result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public Sample FindClosestById(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeById(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - public Sample FindByIdAndAgeAndFirstNameAndLastName((int Id, int Age, string FirstName, string LastName) key) - { - return FindUniqueCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName, string LastName)>.Default, key, true); - } - - public bool TryFindByIdAndAgeAndFirstNameAndLastName((int Id, int Age, string FirstName, string LastName) key, out Sample result) - { - return TryFindUniqueCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName, string LastName)>.Default, key, out result); - } - - public Sample FindClosestByIdAndAgeAndFirstNameAndLastName((int Id, int Age, string FirstName, string LastName) key, bool selectLower = true) - { - return FindUniqueClosestCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName, string LastName)>.Default, key, selectLower); - } - - public RangeView FindRangeByIdAndAgeAndFirstNameAndLastName((int Id, int Age, string FirstName, string LastName) min, (int Id, int Age, string FirstName, string LastName) max, bool ascendant = true) - { - return FindUniqueRangeCore(secondaryIndex1, secondaryIndex1Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName, string LastName)>.Default, min, max, ascendant); - } - - public Sample FindByIdAndAge((int Id, int Age) key) - { - return FindUniqueCore(secondaryIndex2, secondaryIndex2Selector, System.Collections.Generic.Comparer<(int Id, int Age)>.Default, key, true); - } - - public bool TryFindByIdAndAge((int Id, int Age) key, out Sample result) - { - return TryFindUniqueCore(secondaryIndex2, secondaryIndex2Selector, System.Collections.Generic.Comparer<(int Id, int Age)>.Default, key, out result); - } - - public Sample FindClosestByIdAndAge((int Id, int Age) key, bool selectLower = true) - { - return FindUniqueClosestCore(secondaryIndex2, secondaryIndex2Selector, System.Collections.Generic.Comparer<(int Id, int Age)>.Default, key, selectLower); - } - - public RangeView FindRangeByIdAndAge((int Id, int Age) min, (int Id, int Age) max, bool ascendant = true) - { - return FindUniqueRangeCore(secondaryIndex2, secondaryIndex2Selector, System.Collections.Generic.Comparer<(int Id, int Age)>.Default, min, max, ascendant); - } - - public Sample FindByIdAndAgeAndFirstName((int Id, int Age, string FirstName) key) - { - return FindUniqueCore(secondaryIndex3, secondaryIndex3Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName)>.Default, key, true); - } - - public bool TryFindByIdAndAgeAndFirstName((int Id, int Age, string FirstName) key, out Sample result) - { - return TryFindUniqueCore(secondaryIndex3, secondaryIndex3Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName)>.Default, key, out result); - } - - public Sample FindClosestByIdAndAgeAndFirstName((int Id, int Age, string FirstName) key, bool selectLower = true) - { - return FindUniqueClosestCore(secondaryIndex3, secondaryIndex3Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName)>.Default, key, selectLower); - } - - public RangeView FindRangeByIdAndAgeAndFirstName((int Id, int Age, string FirstName) min, (int Id, int Age, string FirstName) max, bool ascendant = true) - { - return FindUniqueRangeCore(secondaryIndex3, secondaryIndex3Selector, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName)>.Default, min, max, ascendant); - } - - public RangeView FindByAge(int key) - { - return FindManyCore(secondaryIndex5, secondaryIndex5Selector, System.Collections.Generic.Comparer.Default, key); - } - - public RangeView FindClosestByAge(int key, bool selectLower = true) - { - return FindManyClosestCore(secondaryIndex5, secondaryIndex5Selector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByAge(int min, int max, bool ascendant = true) - { - return FindManyRangeCore(secondaryIndex5, secondaryIndex5Selector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - public RangeView FindByFirstNameAndAge((string FirstName, int Age) key) - { - return FindManyCore(secondaryIndex6, secondaryIndex6Selector, System.Collections.Generic.Comparer<(string FirstName, int Age)>.Default, key); - } - - public RangeView FindClosestByFirstNameAndAge((string FirstName, int Age) key, bool selectLower = true) - { - return FindManyClosestCore(secondaryIndex6, secondaryIndex6Selector, System.Collections.Generic.Comparer<(string FirstName, int Age)>.Default, key, selectLower); - } - - public RangeView FindRangeByFirstNameAndAge((string FirstName, int Age) min, (string FirstName, int Age) max, bool ascendant = true) - { - return FindManyRangeCore(secondaryIndex6, secondaryIndex6Selector, System.Collections.Generic.Comparer<(string FirstName, int Age)>.Default, min, max, ascendant); - } - - public Sample FindByFirstNameAndLastName((string FirstName, string LastName) key) - { - return FindUniqueCore(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, key, true); - } - - public bool TryFindByFirstNameAndLastName((string FirstName, string LastName) key, out Sample result) - { - return TryFindUniqueCore(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, key, out result); - } - - public Sample FindClosestByFirstNameAndLastName((string FirstName, string LastName) key, bool selectLower = true) - { - return FindUniqueClosestCore(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, key, selectLower); - } - - public RangeView FindRangeByFirstNameAndLastName((string FirstName, string LastName) min, (string FirstName, string LastName) max, bool ascendant = true) - { - return FindUniqueRangeCore(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default, min, max, ascendant); - } - - public RangeView FindByFirstName(string key) - { - return FindManyCore(secondaryIndex4, secondaryIndex4Selector, System.StringComparer.Ordinal, key); - } - - public RangeView FindClosestByFirstName(string key, bool selectLower = true) - { - return FindManyClosestCore(secondaryIndex4, secondaryIndex4Selector, System.StringComparer.Ordinal, key, selectLower); - } - - public RangeView FindRangeByFirstName(string min, string max, bool ascendant = true) - { - return FindManyRangeCore(secondaryIndex4, secondaryIndex4Selector, System.StringComparer.Ordinal, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "Id", resultSet); - ValidateUniqueCore(secondaryIndex1, secondaryIndex1Selector, "(Id, Age, FirstName, LastName)", resultSet); - ValidateUniqueCore(secondaryIndex2, secondaryIndex2Selector, "(Id, Age)", resultSet); - ValidateUniqueCore(secondaryIndex3, secondaryIndex3Selector, "(Id, Age, FirstName)", resultSet); - ValidateUniqueCore(secondaryIndex0, secondaryIndex0Selector, "(FirstName, LastName)", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(Sample), typeof(SampleTable), "s_a_m_p_l_e", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(Sample).GetProperty("Id")), - new MasterMemory.Meta.MetaProperty(typeof(Sample).GetProperty("Age")), - new MasterMemory.Meta.MetaProperty(typeof(Sample).GetProperty("FirstName")), - new MasterMemory.Meta.MetaProperty(typeof(Sample).GetProperty("LastName")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("Id"), - }, true, true, System.Collections.Generic.Comparer.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("Id"), - typeof(Sample).GetProperty("Age"), - typeof(Sample).GetProperty("FirstName"), - typeof(Sample).GetProperty("LastName"), - }, false, true, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName, string LastName)>.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("Id"), - typeof(Sample).GetProperty("Age"), - }, false, true, System.Collections.Generic.Comparer<(int Id, int Age)>.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("Id"), - typeof(Sample).GetProperty("Age"), - typeof(Sample).GetProperty("FirstName"), - }, false, true, System.Collections.Generic.Comparer<(int Id, int Age, string FirstName)>.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("Age"), - }, false, false, System.Collections.Generic.Comparer.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("FirstName"), - typeof(Sample).GetProperty("Age"), - }, false, false, System.Collections.Generic.Comparer<(string FirstName, int Age)>.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("FirstName"), - typeof(Sample).GetProperty("LastName"), - }, false, true, System.Collections.Generic.Comparer<(string FirstName, string LastName)>.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(Sample).GetProperty("FirstName"), - }, false, false, System.StringComparer.Ordinal), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/SequentialCheckMasterTable.cs b/tests/MasterMemory.Tests/Generated/Tables/SequentialCheckMasterTable.cs deleted file mode 100644 index 42dc0e77..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/SequentialCheckMasterTable.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class SequentialCheckMasterTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public SequentialCheckMasterTable(SequentialCheckMaster[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.Id; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public SequentialCheckMaster FindById(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindById(int key, out SequentialCheckMaster result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public SequentialCheckMaster FindClosestById(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeById(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "Id", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(SequentialCheckMaster), typeof(SequentialCheckMasterTable), "sequantial_master", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(SequentialCheckMaster).GetProperty("Id")), - new MasterMemory.Meta.MetaProperty(typeof(SequentialCheckMaster).GetProperty("Cost")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(SequentialCheckMaster).GetProperty("Id"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/SingleMasterTable.cs b/tests/MasterMemory.Tests/Generated/Tables/SingleMasterTable.cs deleted file mode 100644 index b428cde7..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/SingleMasterTable.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class SingleMasterTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public SingleMasterTable(SingleMaster[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.Id; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public SingleMaster FindById(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindById(int key, out SingleMaster result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Id; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public SingleMaster FindClosestById(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeById(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "Id", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(SingleMaster), typeof(SingleMasterTable), "single_master", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(SingleMaster).GetProperty("Id")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(SingleMaster).GetProperty("Id"), - }, true, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/SkillMasterTable.cs b/tests/MasterMemory.Tests/Generated/Tables/SkillMasterTable.cs deleted file mode 100644 index aa6f57bb..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/SkillMasterTable.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class SkillMasterTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public SkillMasterTable(SkillMaster[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => (x.SkillId, x.SkillLevel); - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - public SkillMaster FindBySkillIdAndSkillLevel((int SkillId, int SkillLevel) key) - { - return FindUniqueCore(data, primaryIndexSelector, System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default, key, true); - } - - public bool TryFindBySkillIdAndSkillLevel((int SkillId, int SkillLevel) key, out SkillMaster result) - { - return TryFindUniqueCore(data, primaryIndexSelector, System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default, key, out result); - } - - public SkillMaster FindClosestBySkillIdAndSkillLevel((int SkillId, int SkillLevel) key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default, key, selectLower); - } - - public RangeView FindRangeBySkillIdAndSkillLevel((int SkillId, int SkillLevel) min, (int SkillId, int SkillLevel) max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "(SkillId, SkillLevel)", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(SkillMaster), typeof(SkillMasterTable), "skillmaster", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(SkillMaster).GetProperty("SkillId")), - new MasterMemory.Meta.MetaProperty(typeof(SkillMaster).GetProperty("SkillLevel")), - new MasterMemory.Meta.MetaProperty(typeof(SkillMaster).GetProperty("AttackPower")), - new MasterMemory.Meta.MetaProperty(typeof(SkillMaster).GetProperty("SkillName")), - new MasterMemory.Meta.MetaProperty(typeof(SkillMaster).GetProperty("Description")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(SkillMaster).GetProperty("SkillId"), - typeof(SkillMaster).GetProperty("SkillLevel"), - }, true, true, System.Collections.Generic.Comparer<(int SkillId, int SkillLevel)>.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/TestMasterTable.cs b/tests/MasterMemory.Tests/Generated/Tables/TestMasterTable.cs deleted file mode 100644 index e21474c8..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/TestMasterTable.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests.TestStructures; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System.Text; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class TestMasterTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - - public TestMasterTable(TestMaster[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.TestID; - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - - public RangeView FindByTestID(int key) - { - return FindManyCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key); - } - - public RangeView FindClosestByTestID(int key, bool selectLower = true) - { - return FindManyClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByTestID(int min, int max, bool ascendant = true) - { - return FindManyRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(TestMaster), typeof(TestMasterTable), "TestMaster", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(TestMaster).GetProperty("TestID")), - new MasterMemory.Meta.MetaProperty(typeof(TestMaster).GetProperty("Value")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(TestMaster).GetProperty("TestID"), - }, true, false, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/Generated/Tables/UserLevelTable.cs b/tests/MasterMemory.Tests/Generated/Tables/UserLevelTable.cs deleted file mode 100644 index a37d5ace..00000000 --- a/tests/MasterMemory.Tests/Generated/Tables/UserLevelTable.cs +++ /dev/null @@ -1,131 +0,0 @@ -// -#pragma warning disable CS0105 -using MasterMemory.Tests; -using MasterMemory.Validation; -using MasterMemory; -using MessagePack; -using System.Collections.Generic; -using System; - -namespace MasterMemory.Tests.Tables -{ - public sealed partial class UserLevelTable : TableBase, ITableUniqueValidate - { - public Func PrimaryKeySelector => primaryIndexSelector; - readonly Func primaryIndexSelector; - - readonly UserLevel[] secondaryIndex0; - readonly Func secondaryIndex0Selector; - - public UserLevelTable(UserLevel[] sortedData) - : base(sortedData) - { - this.primaryIndexSelector = x => x.Level; - this.secondaryIndex0Selector = x => x.Exp; - this.secondaryIndex0 = CloneAndSortBy(this.secondaryIndex0Selector, System.Collections.Generic.Comparer.Default); - OnAfterConstruct(); - } - - partial void OnAfterConstruct(); - - public RangeView SortByExp => new RangeView(secondaryIndex0, 0, secondaryIndex0.Length - 1, true); - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public UserLevel FindByLevel(int key) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Level; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { return data[mid]; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - return ThrowKeyNotFound(key); - } - - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - public bool TryFindByLevel(int key, out UserLevel result) - { - var lo = 0; - var hi = data.Length - 1; - while (lo <= hi) - { - var mid = (int)(((uint)hi + (uint)lo) >> 1); - var selected = data[mid].Level; - var found = (selected < key) ? -1 : (selected > key) ? 1 : 0; - if (found == 0) { result = data[mid]; return true; } - if (found < 0) { lo = mid + 1; } - else { hi = mid - 1; } - } - result = default; - return false; - } - - public UserLevel FindClosestByLevel(int key, bool selectLower = true) - { - return FindUniqueClosestCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByLevel(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(data, primaryIndexSelector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - public UserLevel FindByExp(int key) - { - return FindUniqueCoreInt(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer.Default, key, true); - } - - public bool TryFindByExp(int key, out UserLevel result) - { - return TryFindUniqueCoreInt(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer.Default, key, out result); - } - - public UserLevel FindClosestByExp(int key, bool selectLower = true) - { - return FindUniqueClosestCore(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer.Default, key, selectLower); - } - - public RangeView FindRangeByExp(int min, int max, bool ascendant = true) - { - return FindUniqueRangeCore(secondaryIndex0, secondaryIndex0Selector, System.Collections.Generic.Comparer.Default, min, max, ascendant); - } - - - void ITableUniqueValidate.ValidateUnique(ValidateResult resultSet) - { -#if !DISABLE_MASTERMEMORY_VALIDATOR - - ValidateUniqueCore(data, primaryIndexSelector, "Level", resultSet); - ValidateUniqueCore(secondaryIndex0, secondaryIndex0Selector, "Exp", resultSet); - -#endif - } - -#if !DISABLE_MASTERMEMORY_METADATABASE - - public static MasterMemory.Meta.MetaTable CreateMetaTable() - { - return new MasterMemory.Meta.MetaTable(typeof(UserLevel), typeof(UserLevelTable), "UserLevel", - new MasterMemory.Meta.MetaProperty[] - { - new MasterMemory.Meta.MetaProperty(typeof(UserLevel).GetProperty("Level")), - new MasterMemory.Meta.MetaProperty(typeof(UserLevel).GetProperty("Exp")), - }, - new MasterMemory.Meta.MetaIndex[]{ - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(UserLevel).GetProperty("Level"), - }, true, true, System.Collections.Generic.Comparer.Default), - new MasterMemory.Meta.MetaIndex(new System.Reflection.PropertyInfo[] { - typeof(UserLevel).GetProperty("Exp"), - }, false, true, System.Collections.Generic.Comparer.Default), - }); - } - -#endif - } -} \ No newline at end of file diff --git a/tests/MasterMemory.Tests/MasterMemory.Tests.csproj b/tests/MasterMemory.Tests/MasterMemory.Tests.csproj index de4c2780..d9e02c8c 100644 --- a/tests/MasterMemory.Tests/MasterMemory.Tests.csproj +++ b/tests/MasterMemory.Tests/MasterMemory.Tests.csproj @@ -1,26 +1,29 @@  - net6.0 + net9.0 false + + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + Analyzer + false + - - + + + - + diff --git a/tests/MasterMemory.Tests/MessagePackResolver.cs b/tests/MasterMemory.Tests/MessagePackResolver.cs index d223acee..c5ee264f 100644 --- a/tests/MasterMemory.Tests/MessagePackResolver.cs +++ b/tests/MasterMemory.Tests/MessagePackResolver.cs @@ -1,26 +1,7 @@ using MessagePack; -using MessagePack.Formatters; using MessagePack.Resolvers; -using System; -using System.Collections.Generic; -using System.Text; -namespace MasterMemory.Tests -{ - public class MessagePackResolver : IFormatterResolver - { - public static IFormatterResolver Instance = new MessagePackResolver(); +namespace MasterMemory.Tests; - MessagePackResolver() - { - - } - - public IMessagePackFormatter GetFormatter() - { - return MasterMemoryResolver.Instance.GetFormatter() - ?? GeneratedResolver.Instance.GetFormatter() - ?? StandardResolver.Instance.GetFormatter(); - } - } -} +[CompositeResolver(typeof(MasterMemoryResolver), typeof(StandardResolver))] +public partial class MessagePackResolver; \ No newline at end of file