public void NullFile_ShouldDoNothing() { IPropertiesFile file = null; ICommand cmd = new RemovePropertyByKeyCommand(file, "TestKey"); cmd.Execute(); }
public void RemovePropertiesFile(IPropertiesFile file) { if (!_propertiesFiles.Contains(file)) { throw new ArgumentException("No such file is tracked"); } _propertiesFiles.Remove(file); _eventAggregator.GetEvent <PubSubEvent <RemovedPropertiesFileEvent> >().Publish(new RemovedPropertiesFileEvent(file)); }
public FileWithTwoProperties() { _file = new InMemoryPropertiesFile(new List <PropertyPair> { new PropertyPair { Key = "Key1", Value = "Value1" }, new PropertyPair { Key = "Key2", Value = "Value2" } }); }
public Task <IReadOnlyDictionary <string, string> > ParseFileAsync(IPropertiesFile file) { return(Task.Run(() => { var dataWriteable = new Dictionary <string, string>(); var streamReader = new StreamReader(file.FilePath.OpenRead()); string line; while ((line = streamReader.ReadLine()) != null) { var strings = line.Split('='); dataWriteable.Add(strings[0], strings[1]); } return new ReadOnlyDictionary <string, string>(dataWriteable) as IReadOnlyDictionary <string, string>; })); }
public async Task <IEnumerable <ValidationResult> > ValidateFile(IPropertiesFile propertiesFile) { var validationRules = _container.ResolveAll <IValidationRule <IPropertiesFile> >(); List <ValidationResult> results = new List <ValidationResult>(); foreach (IValidationRule <IPropertiesFile> validationRule in validationRules) { try { results.AddRange(await validationRule.ValidateAsync(propertiesFile)); } catch (Exception e) { return(new[] { new ValidationResult(e.Message) }); } } return(results); }
public AddedPropertiesFileEvent(IPropertiesFile propertiesFile) : base(propertiesFile) { }
protected PropertiesFileEventBase(IPropertiesFile propertiesFile) { _propertiesFile = propertiesFile; }
public AddPropertyCommand(IPropertiesFile file, PropertyPair newProperty, IUserConfirmation userConfirmation) { _file = file; _propertyToAdd = newProperty; _userConfirmation = userConfirmation; }
public void RemovePropertiesFile(IPropertiesFile file) { throw new NotImplementedException(); }
public RemovedPropertiesFileEvent(IPropertiesFile propertiesFile) : base(propertiesFile) { }
public StripCommentsCommand(IPropertiesFile file) { _file = file; }
public RemovePropertyByKeyCommand(IPropertiesFile file, string targetKey) { _file = file; _targetKey = targetKey; }
public FileViewModel(IPropertiesFile propFile, IPropertiesFileService propertiesFileService) { _propertiesFile = propFile; _propertiesFileService = propertiesFileService; }
public PlusNameJob() { propertiesFile = new PropertiesFileReName(); }
public StripEmptyLinesCommand(IPropertiesFile file) { _file = file; }