Skip to content

Commit

Permalink
v3.2.1-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
runceel committed Sep 29, 2019
1 parent 300013a commit e16fa0c
Show file tree
Hide file tree
Showing 50 changed files with 1,093 additions and 802 deletions.
57 changes: 44 additions & 13 deletions Livet.Code.sln
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.29324.140
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask", "LivetCask\LivetCask.csproj", "{6A4E6038-17ED-4CBA-8261-359A4436F9E7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask", "LivetCask\LivetCask.csproj", "{6A4E6038-17ED-4CBA-8261-359A4436F9E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.Behaviors", "LivetCask.Behaviors\LivetCask.Behaviors.csproj", "{9CE78389-63DA-4681-98F1-DEDBE7982E58}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Behaviors", "LivetCask.Behaviors\LivetCask.Behaviors.csproj", "{9CE78389-63DA-4681-98F1-DEDBE7982E58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.Converters", "LivetCask.Converters\LivetCask.Converters.csproj", "{E216160C-7A4E-41D8-BE64-DFF869B2FB32}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Converters", "LivetCask.Converters\LivetCask.Converters.csproj", "{E216160C-7A4E-41D8-BE64-DFF869B2FB32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.Core", "LivetCask.Core\LivetCask.Core.csproj", "{74FFEBB4-5DE7-4F0B-BB8A-4915A1034383}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Core", "LivetCask.Core\LivetCask.Core.csproj", "{74FFEBB4-5DE7-4F0B-BB8A-4915A1034383}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.EventListeners", "LivetCask.EventListeners\LivetCask.EventListeners.csproj", "{BD64E000-2725-4AD9-8505-C8E29C9A5D85}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.EventListeners", "LivetCask.EventListeners\LivetCask.EventListeners.csproj", "{BD64E000-2725-4AD9-8505-C8E29C9A5D85}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.Extensions", "LivetCask.Extensions\LivetCask.Extensions.csproj", "{2A113BF2-287B-4BF3-A4AC-2BF53153AE1D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Extensions", "LivetCask.Extensions\LivetCask.Extensions.csproj", "{2A113BF2-287B-4BF3-A4AC-2BF53153AE1D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.Messaging", "LivetCask.Messaging\LivetCask.Messaging.csproj", "{94C5EDA8-AEAF-49C2-AA45-9F99A0A3907A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Messaging", "LivetCask.Messaging\LivetCask.Messaging.csproj", "{94C5EDA8-AEAF-49C2-AA45-9F99A0A3907A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LivetCask.Collections", "LivetCask.Collections\LivetCask.Collections.csproj", "{D9CCD1BF-29E4-4FA8-9F97-9A035FF14DAB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Collections", "LivetCask.Collections\LivetCask.Collections.csproj", "{D9CCD1BF-29E4-4FA8-9F97-9A035FF14DAB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.StatefulModel", "LivetCask.StatefulModel\LivetCask.StatefulModel.csproj", "{710B9565-86D5-4473-8E64-70343D4F4021}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivetCask.Mvvm", "LivetCask.Mvvm\LivetCask.Mvvm.csproj", "{C56DF371-8683-4023-8D86-C49252229838}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -28,9 +32,6 @@ Global
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6A4E6038-17ED-4CBA-8261-359A4436F9E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A4E6038-17ED-4CBA-8261-359A4436F9E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand Down Expand Up @@ -128,5 +129,35 @@ Global
{D9CCD1BF-29E4-4FA8-9F97-9A035FF14DAB}.Release|x64.Build.0 = Release|Any CPU
{D9CCD1BF-29E4-4FA8-9F97-9A035FF14DAB}.Release|x86.ActiveCfg = Release|Any CPU
{D9CCD1BF-29E4-4FA8-9F97-9A035FF14DAB}.Release|x86.Build.0 = Release|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Debug|Any CPU.Build.0 = Debug|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Debug|x64.ActiveCfg = Debug|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Debug|x64.Build.0 = Debug|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Debug|x86.ActiveCfg = Debug|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Debug|x86.Build.0 = Debug|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Release|Any CPU.ActiveCfg = Release|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Release|Any CPU.Build.0 = Release|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Release|x64.ActiveCfg = Release|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Release|x64.Build.0 = Release|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Release|x86.ActiveCfg = Release|Any CPU
{710B9565-86D5-4473-8E64-70343D4F4021}.Release|x86.Build.0 = Release|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Debug|x64.ActiveCfg = Debug|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Debug|x64.Build.0 = Debug|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Debug|x86.ActiveCfg = Debug|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Debug|x86.Build.0 = Debug|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Release|Any CPU.Build.0 = Release|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Release|x64.ActiveCfg = Release|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Release|x64.Build.0 = Release|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Release|x86.ActiveCfg = Release|Any CPU
{C56DF371-8683-4023-8D86-C49252229838}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AE35214-2220-49A3-B3E2-0316B3C80891}
EndGlobalSection
EndGlobal
7 changes: 5 additions & 2 deletions Livet.Test/Livet.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
<TargetFrameworks>netcoreapp3.0;net452</TargetFrameworks>
<UseWpf>true</UseWpf>
<IsPackable>false</IsPackable>
<RootNamespace>Livet.NUnit</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.0.1" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<!-- Conditionally obtain references for the .NET Framework 4.5 target -->
Expand All @@ -25,6 +27,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\LivetCask.StatefulModel\LivetCask.StatefulModel.csproj" />
<ProjectReference Include="..\LivetCask\LivetCask.csproj" />
</ItemGroup>

Expand Down
18 changes: 18 additions & 0 deletions Livet.Test/StatefulModel/ConvertingTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Livet.StatefulModel;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;

namespace Livet.NUnit.StatefulModel
{
[TestFixture]
public class ConvertingTest
{
[Test]
public void ToReadOnlyTest()
{
var src = new ObservableSynchronizedCollection<string>();
}
}
}
50 changes: 50 additions & 0 deletions Livet.Test/StatefulModel/FilteredObservableCollectionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using Livet.StatefulModel;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace Livet.NUnit.StatefulModel
{
[TestFixture]
public class FilteredObservableCollectionTest
{
private FilteredObservableCollection<string> _target;
private List<NotifyCollectionChangedEventArgs> _collectionChanged;
[SetUp]
public void SetUp()
{
_target = new FilteredObservableCollection<string>(x => !x.Contains("x"));
_collectionChanged = new List<NotifyCollectionChangedEventArgs>();
_target.CollectionChanged += (_, e) => _collectionChanged.Add(e);
}

[TearDown]
public void TearDown()
{
_target = null;
_collectionChanged = null;
}

[Test]
public void BasicUsage()
{
_target.Add("aaa");
_target.Add("axa");
_target.Add("bbb");
_target.Add("bxb");
_target.Is("aaa", "bbb");

_collectionChanged.SelectMany(x => x.NewItems.Cast<string>())
.Is("aaa", "bbb");
_collectionChanged.Select(x => x.Action)
.Is(
NotifyCollectionChangedAction.Add,
NotifyCollectionChangedAction.Add
);
}
}
}
83 changes: 83 additions & 0 deletions Livet.Test/StatefulModel/ObservableSynchronizedCollectionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using Livet.StatefulModel;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;

namespace Livet.NUnit.StatefulModel
{
[TestFixture]
public class ObservableSynchronizedCollectionTest
{
private ObservableSynchronizedCollection<string> _target;
private List<NotifyCollectionChangedEventArgs> _collectionChanged;
[SetUp]
public void SetUp()
{
_target = new ObservableSynchronizedCollection<string>();
_collectionChanged = new List<NotifyCollectionChangedEventArgs>();
_target.CollectionChanged += (_, args) => _collectionChanged.Add(args);
}

[TearDown]
public void TearDown()
{
_target = null;
_collectionChanged = null;
}

[Test]
public void ConstructorTest()
{
var c = new ObservableSynchronizedCollection<string>(new[] { "a", "b", "c" });
c.Count.Is(3);
}

[Test]
public void BasicUsage()
{
_target.Count.Is(0);

_target.Add("xxx");
_collectionChanged.Count.Is(1);
var collectionChangedEventArgs = _collectionChanged.First();
collectionChangedEventArgs.IsNotNull();
collectionChangedEventArgs.Action.Is(NotifyCollectionChangedAction.Add);
collectionChangedEventArgs.NewItems.Count.Is(1);
collectionChangedEventArgs.NewItems.Cast<string>().First().Is("xxx");
}

[Test]
public void InsertTest()
{
_target.Add("1");
_target.Add("2");
_target.Insert(1, "xxx");

_target.Is("1", "xxx", "2");
_collectionChanged.SelectMany(x => x.NewItems.Cast<string>())
.Is("1", "2", "xxx");
_collectionChanged.Select(x => x.Action)
.Is(NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Add);
}

[Test]
public void RemoveTest()
{
_target.Add("1");
_target.Add("2");

_target.Remove("1");
_target.Is("2");

_collectionChanged.Select(x => x.Action)
.Is(NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Remove);
_collectionChanged.SelectMany(x => x.NewItems?.Cast<string>() ?? Enumerable.Empty<string>())
.Is("1", "2");
_collectionChanged.Last().OldItems.Count.Is(1);
_collectionChanged.Last().OldItems.Cast<string>().Is("1");
}
}
}
53 changes: 53 additions & 0 deletions Livet.Test/StatefulModel/SortedObservableCollectionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Livet.StatefulModel;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace Livet.NUnit.StatefulModel
{
[TestFixture]
public class SortedObservableCollectionTest
{
private SortedObservableCollection<(int key, string value), int> _target;
private List<NotifyCollectionChangedEventArgs> _collectionChanged;

[SetUp]
public void SetUp()
{
_target = new SortedObservableCollection<(int key, string value), int>(x => x.key);
_collectionChanged = new List<NotifyCollectionChangedEventArgs>();
_target.CollectionChanged += (_, e) => _collectionChanged.Add(e);
}

[TearDown]
public void TearDown()
{
_target = null;
_collectionChanged = null;
}

[Test]
public void BasicUsage()
{
_target.Add((100, "max"));
_target.Add((0, "min"));
_target.Add((50, "mid"));

_target.Count.Is(3);
_target.Is(
(0, "min"),
(50, "mid"),
(100, "max")
);

_collectionChanged.Select(x => x.Action)
.Is(NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Add);
_collectionChanged.Select(x => x.NewStartingIndex)
.Is(0, 0, 1);
}
}
}
73 changes: 73 additions & 0 deletions Livet.Test/StatefulModel/SynchronizationContextCollectionTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Livet.StatefulModel;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;

namespace Livet.NUnit.StatefulModel
{
[TestFixture]
public class SynchronizationContextCollectionTest
{
private TestSynchronizationContext _context;
private SynchronizationContextCollection<string> _target;
private List<NotifyCollectionChangedEventArgs> _collectionChanged;

[SetUp]
public void SetUp()
{
_context = new TestSynchronizationContext();
_target = new SynchronizationContextCollection<string>(_context);
_collectionChanged = new List<NotifyCollectionChangedEventArgs>();
_target.CollectionChanged += (_, e) => _collectionChanged.Add(e);
}

[TearDown]
public void TearDown()
{
_target = null;
_context = null;
}

[Test]
public void BasicUsage()
{
_target.Add("a");
_target.Add("b");
_target.Add("c");
_target.Remove("b");
_target[1] = "C";

_target.Is("a", "C");
_context.Count.Is(5);

_collectionChanged.Select(x => x.Action)
.Is(
NotifyCollectionChangedAction.Add,
NotifyCollectionChangedAction.Add,
NotifyCollectionChangedAction.Add,
NotifyCollectionChangedAction.Remove,
NotifyCollectionChangedAction.Replace
);
_collectionChanged.SelectMany(x => x.NewItems?.Cast<string>() ?? Enumerable.Empty<string>())
.Is("a", "b", "c", "C");
_collectionChanged[3].OldItems.Cast<string>().Is("b");
_collectionChanged[4].Is(
x => x.Action == NotifyCollectionChangedAction.Replace && x.NewItems.Cast<string>().ElementAt(0) == "C" && x.NewStartingIndex == 1);
}

class TestSynchronizationContext : SynchronizationContext
{
public int Count { get; set; }
public override void Post(SendOrPostCallback d, object state)
{
Count++;
d(state);
}
}
}
}
Loading

0 comments on commit e16fa0c

Please sign in to comment.