添加项目文件。

This commit is contained in:
akwkevin
2021-07-23 09:42:22 +08:00
commit f25a958797
2798 changed files with 352360 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
namespace Fluent.Tests.Collections
{
using System.Collections.ObjectModel;
using Fluent.Collections;
using NUnit.Framework;
[TestFixture]
public class CollectionSyncHelperTests
{
[Test]
public void NewInstanceShouldCopyItems()
{
var source = new ObservableCollection<string> { "One", "Two" };
var target = new ObservableCollection<string>();
Assert.That(target, Is.Not.EquivalentTo(source));
var sync = new CollectionSyncHelper<string>(source, target);
Assert.That(target, Is.EquivalentTo(source));
}
[Test]
public void CollectionActionShouldSync()
{
var source = new ObservableCollection<string>();
var target = new ObservableCollection<string>();
Assert.That(target, Is.EquivalentTo(source));
var sync = new CollectionSyncHelper<string>(source, target);
Assert.That(target, Is.EquivalentTo(source));
{
source.Add("One");
Assert.That(target, Is.EquivalentTo(source));
}
{
source.RemoveAt(0);
Assert.That(target, Is.EquivalentTo(source));
}
{
source.Add("One");
Assert.That(target, Is.EquivalentTo(source));
}
{
source[0] = "Two";
Assert.That(target, Is.EquivalentTo(source));
}
{
source.Clear();
Assert.That(target, Is.EquivalentTo(source));
}
}
}
}