public void UpdateSectionStateTest(bool validSection, string stateJson, string expectedJson) { // Assign var section = new PreSearchFilterSection { Options = validSection ? new List <PreSearchFilterOption> { new PreSearchFilterOption { IsSelected = true, Name = nameof(PreSearchFilterOption.Name), OptionKey = nameof(PreSearchFilterOption.OptionKey) } } : new List <PreSearchFilterOption>() }; // Act var testObject = new PreSearchFilterStateManager(); testObject.RestoreState(stateJson); testObject.UpdateSectionState(section); // Assert testObject.GetStateJson().Should().BeEquivalentTo(expectedJson); }
public void SaveStateTest(bool validPreviousSection, bool singleValue, string expectedJson) { // Assign var stateJson = "{\"Sections\":[]}"; var section = validPreviousSection ? new PreSearchFilterSection { Options = new List <PreSearchFilterOption> { new PreSearchFilterOption { IsSelected = true, Name = nameof(PreSearchFilterOption.Name), OptionKey = nameof(PreSearchFilterSection.SingleSelectedValue) } }, SingleSelectedValue = singleValue ? nameof(PreSearchFilterSection.SingleSelectedValue) : string.Empty, SingleSelectOnly = singleValue } : null; // Act var testObject = new PreSearchFilterStateManager(); testObject.RestoreState(stateJson); testObject.SaveState(section); // Assert testObject.GetStateJson().Should().BeEquivalentTo(expectedJson); }
public void RestoreStateTest(string stateJson) { // Act var testObject = new PreSearchFilterStateManager(); testObject.RestoreState(stateJson); // Assert testObject.GetStateJson().Should().BeEquivalentTo(stateJson); }