public void IsEmpty_IsFalse_IfPatternIsSetToNonEmpty()
        {
            var model = new PatternViewModel("");
            model.Pattern.Value = "x";

            Assert.False(model.IsEmpty.Value);
        }
        public void IsEmpty_IsTrue_IfPatternIsSetToEmpty()
        {
            var model = new PatternViewModel("x");
            model.Pattern.Value = "";

            Assert.True(model.IsEmpty.Value);
        }
        public void PatternChange_RemovesItemToData_IfPatternIsNotSet()
        {
            var data = new Collection<PatternData>();
            var model = new PatternCollectionViewModel(data);
            var pattern = new PatternViewModel("x");
            model.Values.Add(pattern);

            pattern.Pattern.Value = "";
            Assert.Empty(data);
        }
        public void PatternChange_AddsItemToData_IfPatternIsSet()
        {
            var data = new Collection<PatternData>();
            var model = new PatternCollectionViewModel(data);
            var pattern = new PatternViewModel("");
            model.Values.Add(pattern);

            pattern.Pattern.Value = "x";
            Assert.Equal(new[] { "x" }, data.Select(p => p.Regex.ToString()));
        }
 public void Pattern_IsSetFromDataRegex()
 {
     var model = new PatternViewModel(new PatternData(new Regex("x")));
     Assert.Equal("x", model.Pattern.Value);
 }
 public void Enabled_IsSetFromDataEnabled()
 {
     var model = new PatternViewModel(new PatternData(new Regex("")) { Enabled = false });
     Assert.False(model.Enabled.Value);
 }
 public void DataRegex_IsUpdatedWhenPatternIsSet()
 {
     var model = new PatternViewModel("");
     model.Pattern.Value = "x";
     Assert.Equal("x", model.Data.Regex.ToString());
 }
 public void DataEnabled_IsUpdatedWhenEnabledIsSet()
 {
     var model = new PatternViewModel("");
     model.Enabled.Value = !model.Enabled.Value;
     Assert.Equal(model.Enabled.Value, model.Data.Enabled);
 }