public void PersistState_ThrowsForDuplicateKeys()
        {
            // Arrange
            var currentState     = new Dictionary <string, byte[]>();
            var applicationState = new ComponentApplicationState(currentState, new List <ComponentApplicationState.OnPersistingCallback>());
            var myState          = new byte[] { 1, 2, 3, 4 };

            applicationState.PersistState("MyState", myState);

            // Act & Assert
            Assert.Throws <ArgumentException>(() => applicationState.PersistState("MyState", myState));
        }
        public void PersistState_SavesDataToTheStore()
        {
            // Arrange
            var currentState     = new Dictionary <string, byte[]>();
            var applicationState = new ComponentApplicationState(currentState, new List <ComponentApplicationState.OnPersistingCallback>());
            var myState          = new byte[] { 1, 2, 3, 4 };

            // Act
            applicationState.PersistState("MyState", myState);

            // Assert
            Assert.True(currentState.TryGetValue("MyState", out var stored));
            Assert.Equal(myState, stored);
        }