rename test project

This commit is contained in:
h z
2024-07-10 15:43:44 +01:00
parent d37b9957b0
commit a922a8971e
37 changed files with 150 additions and 28 deletions

View File

@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Skeleton.DataStructure;
namespace SkeletonTest.tests;
namespace Skeleton.Test.tests;
public static class CacheItemTest
{
@@ -161,5 +162,33 @@ public static class CacheItemTest
Assert.That(a.BB.Get, Is.EqualTo(0));
Assert.That(b.BA.Get, Is.EqualTo(1));
}
[Test]
public static void Test4()
{
CacheItem<int> x = new CacheItem<int>(s => 1);
CacheItem<int> w = new CacheItem<int>(a => x.GetFrom(a) + x.GetFrom(a));
CacheItem<int> g = new CacheItem<int>(a => w.GetFrom(a) + w.GetFrom(a) + x.GetFrom(a));
Assert.That(g.Get, Is.EqualTo(5));
x.Assign(2);
Console.WriteLine(g.Get);
Assert.That(g.Get, Is.EqualTo(10));
}
[Test]
public static void Test5()
{
CacheItem<int> x1 = new CacheItem<int>(x => 1);
CacheItem<int> x2 = new CacheItem<int>(x => x1.GetFrom(x));
CacheItem<int> x3 = new CacheItem<int>(x => x2.GetFrom(x));
CacheItem<int> x4 = new CacheItem<int>(x => x3.GetFrom(x));
Console.WriteLine(x4.Get);
x1.Assign(3);
Assert.IsTrue(x2.Expired);
Assert.IsTrue(x3.Expired);
Assert.IsTrue(x4.Expired);
Console.WriteLine(x4.Get);
}
}