コード例 #1
0
        public void Root_PassesThroughPreviousState_OnUnknownAction()
        {
            var initialState = new AppState();
            var newState     = Reducers.Root(initialState, "Unknown action");

            Assert.Equal(initialState, newState);
        }
コード例 #2
0
        public void Root_DeletesItem_OnDeleteItem()
        {
            var itemId   = AppState.SampleState.Index[1];
            var newState = Reducers.Root(AppState.SampleState, new Actions.DeleteItem(itemId));

            Assert.DoesNotContain(itemId, (IDictionary <Guid, Item>)newState.Items);
        }
コード例 #3
0
        public void Root_TogglesItemValue_OnToggleItem()
        {
            var item     = new Item();
            var state    = AppState.FromItems(new Item[] { item });
            var newState = Reducers.Root(state, new Actions.ToggleItem(item.ID, true));

            Assert.True(newState.Items[item.ID].ToggleValue);
        }
コード例 #4
0
        public void Root_SetsValueToZero_OnResetAction()
        {
            var newState = Reducers.Root(new AppState(8), new Actions.ResetCounter());

            Assert.Equal(0, newState.CounterValue);
        }
コード例 #5
0
        public void Root_IncrementsValue_OnIncrementAction()
        {
            var newState = Reducers.Root(new AppState(), new Actions.IncrementCounter(5));

            Assert.Equal(5, newState.CounterValue);
        }
コード例 #6
0
        public void Root_PassesThroughPreviousState_OnUnknownAction()
        {
            var newState = Reducers.Root(AppState.Empty, "Unknown action");

            Assert.Equal(AppState.Empty, newState);
        }
コード例 #7
0
        public void Root_EmptiesItemList_OnResetItems()
        {
            var newState = Reducers.Root(AppState.SampleState, new Actions.ResetItems());

            Assert.Empty(newState.Items);
        }
コード例 #8
0
        public void Root_AddsItem_OnAddItem()
        {
            var newState = Reducers.Root(AppState.Empty, new Actions.AddItem());

            Assert.Single(newState.Items);
        }