@@ -11,7 +11,7 @@ public class ComponentApplicationStateTest
11
11
public void InitializeExistingState_SetupsState ( )
12
12
{
13
13
// Arrange
14
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
14
+ var applicationState = new PersistentComponentState ( new Dictionary < string , byte [ ] > ( ) , new List < RegistrationContext > ( ) ) ;
15
15
var existingState = new Dictionary < string , byte [ ] >
16
16
{
17
17
[ "MyState" ] = JsonSerializer . SerializeToUtf8Bytes ( new byte [ ] { 1 , 2 , 3 , 4 } )
@@ -29,7 +29,7 @@ public void InitializeExistingState_SetupsState()
29
29
public void InitializeExistingState_ThrowsIfAlreadyInitialized ( )
30
30
{
31
31
// Arrange
32
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
32
+ var applicationState = new PersistentComponentState ( new Dictionary < string , byte [ ] > ( ) , new List < RegistrationContext > ( ) ) ;
33
33
var existingState = new Dictionary < string , byte [ ] >
34
34
{
35
35
[ "MyState" ] = new byte [ ] { 1 , 2 , 3 , 4 }
@@ -45,7 +45,7 @@ public void InitializeExistingState_ThrowsIfAlreadyInitialized()
45
45
public void TryRetrieveState_ReturnsStateWhenItExists ( )
46
46
{
47
47
// Arrange
48
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
48
+ var applicationState = new PersistentComponentState ( new Dictionary < string , byte [ ] > ( ) , new List < RegistrationContext > ( ) ) ;
49
49
var existingState = new Dictionary < string , byte [ ] >
50
50
{
51
51
[ "MyState" ] = JsonSerializer . SerializeToUtf8Bytes ( new byte [ ] { 1 , 2 , 3 , 4 } )
@@ -64,9 +64,11 @@ public void TryRetrieveState_ReturnsStateWhenItExists()
64
64
public void PersistState_SavesDataToTheStoreAsync ( )
65
65
{
66
66
// Arrange
67
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
68
67
var currentState = new Dictionary < string , byte [ ] > ( ) ;
69
- applicationState . PersistenceContext = new ( currentState ) ;
68
+ var applicationState = new PersistentComponentState ( currentState , new List < RegistrationContext > ( ) )
69
+ {
70
+ PersistingState = true
71
+ } ;
70
72
var myState = new byte [ ] { 1 , 2 , 3 , 4 } ;
71
73
72
74
// Act
@@ -81,9 +83,11 @@ public void PersistState_SavesDataToTheStoreAsync()
81
83
public void PersistState_ThrowsForDuplicateKeys ( )
82
84
{
83
85
// Arrange
84
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
85
86
var currentState = new Dictionary < string , byte [ ] > ( ) ;
86
- applicationState . PersistenceContext = new ( currentState ) ;
87
+ var applicationState = new PersistentComponentState ( currentState , new List < RegistrationContext > ( ) )
88
+ {
89
+ PersistingState = true
90
+ } ;
87
91
var myState = new byte [ ] { 1 , 2 , 3 , 4 } ;
88
92
89
93
applicationState . PersistAsJson ( "MyState" , myState ) ;
@@ -96,9 +100,11 @@ public void PersistState_ThrowsForDuplicateKeys()
96
100
public void PersistAsJson_SerializesTheDataToJsonAsync ( )
97
101
{
98
102
// Arrange
99
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
100
103
var currentState = new Dictionary < string , byte [ ] > ( ) ;
101
- applicationState . PersistenceContext = new ( currentState ) ;
104
+ var applicationState = new PersistentComponentState ( currentState , new List < RegistrationContext > ( ) )
105
+ {
106
+ PersistingState = true
107
+ } ;
102
108
var myState = new byte [ ] { 1 , 2 , 3 , 4 } ;
103
109
104
110
// Act
@@ -113,9 +119,11 @@ public void PersistAsJson_SerializesTheDataToJsonAsync()
113
119
public void PersistAsJson_NullValueAsync ( )
114
120
{
115
121
// Arrange
116
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
117
122
var currentState = new Dictionary < string , byte [ ] > ( ) ;
118
- applicationState . PersistenceContext = new ( currentState ) ;
123
+ var applicationState = new PersistentComponentState ( currentState , new List < RegistrationContext > ( ) )
124
+ {
125
+ PersistingState = true
126
+ } ;
119
127
120
128
// Act
121
129
applicationState . PersistAsJson < byte [ ] > ( "MyState" , null ) ;
@@ -132,7 +140,7 @@ public void TryRetrieveFromJson_DeserializesTheDataFromJson()
132
140
var myState = new byte [ ] { 1 , 2 , 3 , 4 } ;
133
141
var serialized = JsonSerializer . SerializeToUtf8Bytes ( myState ) ;
134
142
var existingState = new Dictionary < string , byte [ ] > ( ) { [ "MyState" ] = serialized } ;
135
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
143
+ var applicationState = new PersistentComponentState ( new Dictionary < string , byte [ ] > ( ) , new List < RegistrationContext > ( ) ) ;
136
144
137
145
applicationState . InitializeExistingState ( existingState ) ;
138
146
@@ -150,7 +158,7 @@ public void TryRetrieveFromJson_NullValue()
150
158
// Arrange
151
159
var serialized = JsonSerializer . SerializeToUtf8Bytes < byte [ ] > ( null ) ;
152
160
var existingState = new Dictionary < string , byte [ ] > ( ) { [ "MyState" ] = serialized } ;
153
- var applicationState = new PersistentComponentState ( new List < RegistrationContext > ( ) ) ;
161
+ var applicationState = new PersistentComponentState ( new Dictionary < string , byte [ ] > ( ) , new List < RegistrationContext > ( ) ) ;
154
162
155
163
applicationState . InitializeExistingState ( existingState ) ;
156
164
0 commit comments