public void Root_PassesThroughPreviousState_OnUnknownAction() { var initialState = new AppState(); var newState = Reducers.Root(initialState, "Unknown action"); Assert.Equal(initialState, newState); }
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); }
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); }
public void Root_SetsValueToZero_OnResetAction() { var newState = Reducers.Root(new AppState(8), new Actions.ResetCounter()); Assert.Equal(0, newState.CounterValue); }
public void Root_IncrementsValue_OnIncrementAction() { var newState = Reducers.Root(new AppState(), new Actions.IncrementCounter(5)); Assert.Equal(5, newState.CounterValue); }
public void Root_PassesThroughPreviousState_OnUnknownAction() { var newState = Reducers.Root(AppState.Empty, "Unknown action"); Assert.Equal(AppState.Empty, newState); }
public void Root_EmptiesItemList_OnResetItems() { var newState = Reducers.Root(AppState.SampleState, new Actions.ResetItems()); Assert.Empty(newState.Items); }
public void Root_AddsItem_OnAddItem() { var newState = Reducers.Root(AppState.Empty, new Actions.AddItem()); Assert.Single(newState.Items); }