public SetExtendedAttribute ( string path, string key, string value, bool restoreLastModificationDate = false ) : void | ||
path | string | Sets attribute of this path. |
key | string | Key of the attribute, which should be set. |
value | string | The value to set. |
restoreLastModificationDate | bool | |
return | void |
public void SetAttributeToFile() { using (File.Create(path)); string key = "test"; string value = "value"; var reader = new ExtendedAttributeReaderDos(); reader.SetExtendedAttribute(path, key, value); Assert.That(reader.GetExtendedAttribute(path, key).Equals(value)); }
public void SetExtendedAttributeOnNonExistingFileThrowsIOException() { string key = "test"; var reader = new ExtendedAttributeReaderDos(); Assert.Throws<FileNotFoundException>(() => reader.SetExtendedAttribute(path, key, null)); }
public void RemoveExtendedAttributeOfFileByPassingNull() { using (File.Create(path)); string key = "test"; var reader = new ExtendedAttributeReaderDos(); reader.SetExtendedAttribute(path, key, null); Assert.That(reader.GetExtendedAttribute(path, key), Is.Null); Assert.That(reader.ListAttributeKeys(path).Count == 0); }
public void ListAttributesOfFolder() { Directory.CreateDirectory(path); string key = "test"; string value = "value"; var reader = new ExtendedAttributeReaderDos(); Assert.That(reader.ListAttributeKeys(path).Count == 0); reader.SetExtendedAttribute(path, key, value); Assert.That(reader.ListAttributeKeys(path).Count == 1); Assert.Contains("test", reader.ListAttributeKeys(path)); }
public void RemoveAttributeFromFolder() { Directory.CreateDirectory(path); string key = "test"; string value = "value"; var reader = new ExtendedAttributeReaderDos(); reader.SetExtendedAttribute(path, key, value); Assert.That(reader.GetExtendedAttribute(path, key).Equals(value)); reader.RemoveExtendedAttribute(path, key); Assert.That(reader.GetExtendedAttribute(path, key) == null); }
public void OverwriteAttributeOnFolder() { Directory.CreateDirectory(path); string key = "test"; string value = "value"; string value2 = "value2"; var reader = new ExtendedAttributeReaderDos(); reader.SetExtendedAttribute(path, key, value); reader.SetExtendedAttribute(path, key, value2); Assert.That(reader.GetExtendedAttribute(path, key).Equals(value2)); }