-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathUnitTestHistoryEncryption.cs
More file actions
75 lines (62 loc) · 2.11 KB
/
UnitTestHistoryEncryption.cs
File metadata and controls
75 lines (62 loc) · 2.11 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using InertiaCore;
using InertiaCore.Models;
using InertiaCore.Ssr;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
namespace InertiaCoreTests;
[TestFixture]
public class UnitTestHistoryEncryption
{
[SetUp]
public void Setup()
{
// Set up a factory for testing
var options = new InertiaOptions();
var factory = new ResponseFactory(
new Mock<IHttpContextAccessor>().Object,
new Mock<IGateway>().Object,
Options.Create(options)
);
Inertia.UseFactory(factory);
}
[Test]
public void Inertia_EncryptHistory_MethodExists()
{
// This test verifies the API exists and can be called
Assert.DoesNotThrow(() => Inertia.EncryptHistory(true));
Assert.DoesNotThrow(() => Inertia.EncryptHistory(false));
Assert.DoesNotThrow(() => Inertia.EncryptHistory());
}
[Test]
public void Inertia_ClearHistory_MethodExists()
{
// This test verifies the API exists and can be called
Assert.DoesNotThrow(() => Inertia.ClearHistory(true));
Assert.DoesNotThrow(() => Inertia.ClearHistory(false));
Assert.DoesNotThrow(() => Inertia.ClearHistory());
}
[Test]
public void Page_HasHistoryEncryptionProperties()
{
// This test verifies the Page model has the required properties
var page = new Page();
Assert.That(page.EncryptHistory, Is.False); // Default value
Assert.That(page.ClearHistory, Is.False); // Default value
page.EncryptHistory = true;
page.ClearHistory = true;
Assert.That(page.EncryptHistory, Is.True);
Assert.That(page.ClearHistory, Is.True);
}
[Test]
public void InertiaOptions_HasEncryptHistoryProperty()
{
// This test verifies the options class has the required property
var options = new InertiaOptions();
Assert.That(options.EncryptHistory, Is.False); // Default value
options.EncryptHistory = true;
Assert.That(options.EncryptHistory, Is.True);
}
}