-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRegisterTests.cs
More file actions
61 lines (47 loc) · 2.49 KB
/
RegisterTests.cs
File metadata and controls
61 lines (47 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Threading.Tasks;
using Cleipnir.ResilientFunctions.Helpers;
using Cleipnir.ResilientFunctions.Utils;
using Cleipnir.ResilientFunctions.Utils.Register;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Cleipnir.ResilientFunctions.Tests.InMemoryTests.UtilsTests;
[TestClass]
public class RegisterTests : Cleipnir.ResilientFunctions.Tests.TestTemplates.UtilsTests.RegisterTests
{
[TestMethod]
public override Task SetValueWithNoExistingValueSucceeds()
=> SetValueWithNoExistingValueSucceeds(CreateInMemoryRegister());
[TestMethod]
public override Task CompareAndSwapWithNoExistingValueSucceeds()
=> CompareAndSwapWithNoExistingValueSucceeds(CreateInMemoryRegister());
[TestMethod]
public override Task CompareAndSwapFailsWithNoExistingValue()
=> CompareAndSwapFailsWithNoExistingValue(CreateInMemoryRegister());
[TestMethod]
public override Task SetValueIfEmptyFailsWhenRegisterHasExistingValue()
=> SetValueIfEmptyFailsWhenRegisterHasExistingValue(CreateInMemoryRegister());
[TestMethod]
public override Task CompareAndSwapSucceedsIfAsExpected()
=> CompareAndSwapSucceedsIfAsExpected(CreateInMemoryRegister());
[TestMethod]
public override Task CompareAndSwapSucceedsIfAsExpectedIgnoreIfNoExisting()
=> CompareAndSwapSucceedsIfAsExpectedIgnoreIfNoExisting(CreateInMemoryRegister());
[TestMethod]
public override Task ExistsIfFalseForNonExistingRegister()
=> ExistsIfFalseForNonExistingRegister(CreateInMemoryRegister());
[TestMethod]
public override Task ExistingValueIsNullForNonExistingRegister()
=> ExistingValueIsNullForNonExistingRegister(CreateInMemoryRegister());
[TestMethod]
public override Task DeleteSucceedsForNonExistingRegister()
=> DeleteSucceedsForNonExistingRegister(CreateInMemoryRegister());
[TestMethod]
public override Task DeleteSucceedsForExistingRegister()
=> DeleteSucceedsForExistingRegister(CreateInMemoryRegister());
[TestMethod]
public override Task DeleteSucceedsWithExpectedValueForExistingRegister()
=> DeleteSucceedsWithExpectedValueForExistingRegister(CreateInMemoryRegister());
[TestMethod]
public override Task DeleteFailsWhenNonExpectedValueForExistingRegister()
=> DeleteFailsWhenNonExpectedValueForExistingRegister(CreateInMemoryRegister());
private Task<IRegister> CreateInMemoryRegister() => new Register(new UnderlyingInMemoryRegister()).CastTo<IRegister>().ToTask();
}