├── .github
├── FUNDING.yml
└── ISSUE_TEMPLATE.md
├── .gitignore
├── EditingSystem
├── CodeSnippets
│ └── prope.snippet
├── Jewelry.EditingSystem.Tests
│ ├── GlobalSuppressions.cs
│ ├── Jewelry.EditingSystem.Tests.csproj
│ ├── TestModels
│ │ ├── CollectionItem.cs
│ │ ├── DirectBasicTestModel.cs
│ │ ├── DirectFlagTestModel.cs
│ │ ├── EditableBasicTestModel.cs
│ │ ├── EditableFlagTestModel.cs
│ │ ├── IBasicTestModel.cs
│ │ ├── IFlagTestModel.cs
│ │ ├── TestModelCreator.cs
│ │ ├── TestModelKinds.cs
│ │ └── TestModelKindsTestData.cs
│ └── Tests
│ │ ├── BatchEditingTests.cs
│ │ ├── CollectionItemTests.cs
│ │ ├── CollectionPropertyTests.cs
│ │ ├── FlagPropertyTests.cs
│ │ ├── HistoryTests.cs
│ │ ├── PauseEditingTests.cs
│ │ ├── SetEditablePropertyTests.cs
│ │ ├── SinglePropertyTests.cs
│ │ └── UndoRedoCountTests.cs
├── Jewelry.EditingSystem.sln
├── Jewelry.EditingSystem.sln.DotSettings
└── Jewelry.EditingSystem
│ ├── CollectionChangedWeakEventManager.cs
│ ├── EditableModelBase.cs
│ ├── EditablePropertyCommon.cs
│ ├── History.cs
│ ├── ICollectionItem.cs
│ ├── Jewelry.EditingSystem.csproj
│ ├── ListExtensions.cs
│ └── NotifyPropertyChangedExtensionsForDirectMode.cs
├── LICENSE
└── README.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [YoshihiroIto]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 | **Warning: I will close the bug issue without the minimal project and the reproduce ways.**
3 |
4 | ## Problems summary
5 |
6 |
7 | ## Expected
8 |
9 |
10 | ## Environment Information
11 |
12 | * Target framework version:
13 |
14 | * OS:
15 |
16 |
17 | ## Provide the minimal project
18 |
19 | http://***.***.com/***
20 |
21 |
22 | ## The reproduce ways
23 |
24 | 1. foo
25 | 2. bar
26 | 3. baz
27 |
28 |
29 | ## Screenshot or Videocapture
30 |
31 | http://***.***.com/***.gif
32 |
33 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
--------------------------------------------------------------------------------
/EditingSystem/CodeSnippets/prope.snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | prope
6 | prope
7 | Code snippet for EditableModelBase's property
8 | Yoshihiro Ito (yo.i.jewelry.bab@gmail.com)
9 |
10 |
11 |
12 |
13 | type
14 | Property type
15 | int
16 |
17 |
18 | name
19 | Property name
20 | MyProperty
21 |
22 |
23 | _$name$;
29 | set => SetEditableProperty(v => _$name$, _$name$, value);
30 | }
31 |
32 | #endregion
33 |
34 | $end$]]>
35 |
36 |
37 |
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 |
2 | // This file is used by Code Analysis to maintain SuppressMessage
3 | // attributes that are applied to this project.
4 | // Project-level suppressions either have no target or are given
5 | // a specific target and scoped to a namespace, type, member, etc.
6 |
7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2013:Do not use equality check to check for collection size.", Justification = "<保留中>", Scope = "member", Target = "~M:EditingSJewelry.EditingSystem.TestsionPropertyTests.Add")]
8 |
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/Jewelry.EditingSystem.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | latest
5 | Jewelry.EditingSystem.Tests
6 | enable
7 | net7.0
8 |
9 |
10 |
11 |
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/CollectionItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Jewelry.EditingSystem.Tests
4 | {
5 | public sealed class CollectionItem : ICollectionItem
6 | {
7 | public int CollectionChangedAddCount { get; private set; }
8 | public int CollectionChangedRemoveCount { get; private set; }
9 | public int CollectionChangedMoveCount { get; private set; }
10 |
11 | public void Changed(in CollectionItemChangedInfo info)
12 | {
13 | switch (info.Type)
14 | {
15 | case CollectionItemChangedType.Add:
16 | ++ CollectionChangedAddCount;
17 | break;
18 |
19 | case CollectionItemChangedType.Remove:
20 | ++ CollectionChangedRemoveCount;
21 | break;
22 |
23 | case CollectionItemChangedType.Move:
24 | ++ CollectionChangedMoveCount;
25 | break;
26 |
27 | default:
28 | throw new ArgumentOutOfRangeException(nameof(info.Type), info.Type, null);
29 | }
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/DirectBasicTestModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 |
6 | namespace Jewelry.EditingSystem.Tests.TestModels;
7 |
8 | public sealed class DirectBasicTestModel : IBasicTestModel
9 | {
10 | private readonly History _history;
11 |
12 | public DirectBasicTestModel(History history)
13 | {
14 | _history = history;
15 | }
16 |
17 | public int ChangingCount { get; private set; }
18 |
19 | #region IntValue
20 |
21 | private int _IntValue;
22 |
23 | public int IntValue
24 | {
25 | get => _IntValue;
26 | set
27 | {
28 | if (this.SetEditableProperty(_history, v => SetField(ref _IntValue, v), _IntValue, value))
29 | ++ChangingCount;
30 | }
31 | }
32 |
33 | #endregion
34 |
35 | #region StringValue
36 |
37 | private string _StringValue = "";
38 |
39 | public string StringValue
40 | {
41 | get => _StringValue;
42 | set
43 | {
44 | if (this.SetEditableProperty(_history, v => SetField(ref _StringValue, v), _StringValue, value))
45 | ++ChangingCount;
46 | }
47 | }
48 |
49 | #endregion
50 |
51 | #region IntCollection
52 |
53 | private ObservableCollection _IntCollection = new();
54 |
55 | public ObservableCollection IntCollection
56 | {
57 | get => _IntCollection;
58 | set => this.SetEditableProperty(_history, v => SetField(ref _IntCollection, v), _IntCollection, value);
59 | }
60 |
61 | #endregion
62 |
63 | #region Collection
64 |
65 | private ObservableCollection _Collection = new();
66 |
67 | public ObservableCollection Collection
68 | {
69 | get => _Collection;
70 | set => this.SetEditableProperty(_history, v => _Collection = v, _Collection, value);
71 | }
72 |
73 | #endregion
74 |
75 | public event PropertyChangedEventHandler? PropertyChanged;
76 |
77 | private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
78 | {
79 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
80 | }
81 |
82 | // ReSharper disable once UnusedMethodReturnValue.Local
83 | private bool SetField(ref T field, T value, [CallerMemberName] string? propertyName = null)
84 | {
85 | if (EqualityComparer.Default.Equals(field, value)) return false;
86 | field = value;
87 | OnPropertyChanged(propertyName);
88 | return true;
89 | }
90 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/DirectFlagTestModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 |
6 | namespace Jewelry.EditingSystem.Tests.TestModels;
7 |
8 | public sealed class DirectFlagTestModel : IFlagTestModel
9 | {
10 | private readonly History _history;
11 |
12 | public DirectFlagTestModel(History history)
13 | {
14 | _history = history;
15 | }
16 |
17 | public int ChangingCount { get; private set; }
18 |
19 | public bool IsA
20 | {
21 | get => (_flags & FlagIsA) != default;
22 | set
23 | {
24 | if (this.SetEditableFlagProperty(_history, v => _flags = v, _flags, FlagIsA, value))
25 | ++ChangingCount;
26 | }
27 | }
28 |
29 | public bool IsB
30 | {
31 | get => (_flags & FlagIsB) != default;
32 | set
33 | {
34 | if (this.SetEditableFlagProperty(_history, v => _flags = v, _flags, FlagIsB, value))
35 | ++ChangingCount;
36 | }
37 | }
38 |
39 | public bool IsC
40 | {
41 | get => (_flags & FlagIsC) != default;
42 | set
43 | {
44 | if (this.SetEditableFlagProperty(_history, v => _flags = v, _flags, FlagIsC, value))
45 | ++ChangingCount;
46 | }
47 | }
48 |
49 | private byte _flags;
50 | private const byte FlagIsA = 1 << 0;
51 | private const byte FlagIsB = 1 << 1;
52 | private const byte FlagIsC = 1 << 2;
53 |
54 | public event PropertyChangedEventHandler? PropertyChanged;
55 |
56 | private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
57 | {
58 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
59 | }
60 |
61 | // ReSharper disable once UnusedMethodReturnValue.Local
62 | private bool SetField(ref T field, T value, [CallerMemberName] string? propertyName = null)
63 | {
64 | if (EqualityComparer.Default.Equals(field, value)) return false;
65 | field = value;
66 | OnPropertyChanged(propertyName);
67 | return true;
68 | }
69 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/EditableBasicTestModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace Jewelry.EditingSystem.Tests.TestModels;
4 |
5 | public sealed class EditableBasicTestModel : EditableModelBase, IBasicTestModel
6 | {
7 | public EditableBasicTestModel(History history) : base(history)
8 | {
9 | }
10 |
11 | public int ChangingCount { get; private set; }
12 |
13 | #region IntValue
14 |
15 | private int _IntValue;
16 |
17 | public int IntValue
18 | {
19 | get => _IntValue;
20 | set
21 | {
22 | if (SetEditableProperty(v => _IntValue = v, _IntValue, value))
23 | ++ChangingCount;
24 | }
25 | }
26 |
27 | #endregion
28 |
29 | #region StringValue
30 |
31 | private string _StringValue = "";
32 |
33 | public string StringValue
34 | {
35 | get => _StringValue;
36 | set
37 | {
38 | if (SetEditableProperty(v => _StringValue = v, _StringValue, value))
39 | ++ChangingCount;
40 | }
41 | }
42 |
43 | #endregion
44 |
45 | #region IntCollection
46 |
47 | private ObservableCollection _IntCollection = new();
48 |
49 | public ObservableCollection IntCollection
50 | {
51 | get => _IntCollection;
52 | set => SetEditableProperty(v => _IntCollection = v, _IntCollection, value);
53 | }
54 |
55 | #endregion
56 |
57 | #region Collection
58 |
59 | private ObservableCollection _Collection = new();
60 |
61 | public ObservableCollection Collection
62 | {
63 | get => _Collection;
64 | set => SetEditableProperty(v => _Collection = v, _Collection, value);
65 | }
66 |
67 | #endregion
68 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/EditableFlagTestModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 |
3 | namespace Jewelry.EditingSystem.Tests.TestModels;
4 |
5 | public sealed class EditableFlagTestModel : EditableModelBase, IFlagTestModel
6 | {
7 | public EditableFlagTestModel(History history) : base(history)
8 | {
9 | }
10 |
11 | public int ChangingCount { get; private set; }
12 |
13 | public bool IsA
14 | {
15 | get => (_flags & FlagIsA) != default;
16 | set
17 | {
18 | if (SetEditableFlagProperty(v => _flags = v, _flags, FlagIsA, value))
19 | ++ChangingCount;
20 | }
21 | }
22 |
23 | public bool IsB
24 | {
25 | get => (_flags & FlagIsB) != default;
26 | set
27 | {
28 | if (SetEditableFlagProperty(v => _flags = v, _flags, FlagIsB, value))
29 | ++ChangingCount;
30 | }
31 | }
32 |
33 | public bool IsC
34 | {
35 | get => (_flags & FlagIsC) != default;
36 | set
37 | {
38 | if (SetEditableFlagProperty(v => _flags = v, _flags, FlagIsC, value))
39 | ++ChangingCount;
40 | }
41 | }
42 |
43 | private byte _flags;
44 | private const byte FlagIsA = 1 << 0;
45 | private const byte FlagIsB = 1 << 1;
46 | private const byte FlagIsC = 1 << 2;
47 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/IBasicTestModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.ComponentModel;
3 |
4 | namespace Jewelry.EditingSystem.Tests.TestModels;
5 |
6 | public interface IBasicTestModel : INotifyPropertyChanged
7 | {
8 | int ChangingCount { get; }
9 |
10 | int IntValue { get; set; }
11 | string StringValue { get; set; }
12 |
13 | ObservableCollection IntCollection { get; set; }
14 |
15 | ObservableCollection Collection { get; set; }
16 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/IFlagTestModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.ComponentModel;
3 |
4 | namespace Jewelry.EditingSystem.Tests.TestModels;
5 |
6 | public interface IFlagTestModel : INotifyPropertyChanged
7 | {
8 | int ChangingCount { get; }
9 |
10 | bool IsA { get; set; }
11 | bool IsB { get; set; }
12 | bool IsC { get; set; }
13 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/TestModelCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Jewelry.EditingSystem.Tests.TestModels;
4 |
5 | public static class TestModelCreator
6 | {
7 | public static IBasicTestModel CreateBasicTestModel(TestModelKinds kind, History history)
8 | {
9 | return kind switch
10 | {
11 | TestModelKinds.EditableModel => new EditableBasicTestModel(history),
12 | TestModelKinds.Direct => new DirectBasicTestModel(history),
13 | _ => throw new ArgumentOutOfRangeException(nameof(kind), kind, null)
14 | };
15 | }
16 |
17 | public static IFlagTestModel CreateFlagTestModel(TestModelKinds kind, History history)
18 | {
19 | return kind switch
20 | {
21 | TestModelKinds.EditableModel => new EditableFlagTestModel(history),
22 | TestModelKinds.Direct => new DirectFlagTestModel(history),
23 | _ => throw new ArgumentOutOfRangeException(nameof(kind), kind, null)
24 | };
25 | }
26 | }
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/TestModelKinds.cs:
--------------------------------------------------------------------------------
1 | namespace Jewelry.EditingSystem.Tests.TestModels;
2 |
3 | public enum TestModelKinds
4 | {
5 | EditableModel,
6 | Direct
7 | }
8 |
--------------------------------------------------------------------------------
/EditingSystem/Jewelry.EditingSystem.Tests/TestModels/TestModelKindsTestData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Jewelry.EditingSystem.Tests.TestModels;
7 |
8 | public sealed class TestModelKindsTestData : IEnumerable