public void FromId_IdIsForAPath_ReturnsAContainer() { var id = new SonosIdentifier {Path = "\\abc\\def"}; var resource = PhysicalResource.FromId(id); Assert.That(resource, Is.TypeOf<Container>()); Assert.That(resource.DisplayName, Is.EqualTo("def")); }
public SonosIdentifier FromPath(string path) { if (_pathToGuid.ContainsKey(path)) { return(_pathToGuid[path]); } var identifier = new SonosIdentifier { Id = Guid.NewGuid().ToString(), Path = path }; _pathToGuid.TryAdd(path, identifier); return(identifier); }
public SonosIdentifier IdFor(string path) { if (_hashCache.ContainsKey(path)) { return _hashCache[path]; } var identifier = new SonosIdentifier { Id = _idGen.IdentifierFor(path), Path = path }; _hashCache.TryAdd(path, identifier); return identifier; }
public SonosIdentifier IdFor(string path) { if (_hashCache.ContainsKey(path)) { return(_hashCache[path]); } var identifier = new SonosIdentifier { Id = _idGen.IdentifierFor(path), Path = path }; _hashCache.TryAdd(path, identifier); return(identifier); }
public static PhysicalResource FromId(SonosIdentifier identifier) { return identifier.IsDirectory ? (PhysicalResource) new Container(identifier) : new MusicFile(identifier); }
protected PhysicalResource(SonosIdentifier identifier) { Identifier = identifier; }
public static PhysicalResource FromId(SonosIdentifier identifier) { return(identifier.IsDirectory ? (PhysicalResource) new Container(identifier) : new MusicFile(identifier)); }
public void CreatedWithAPath_IsDirectoryIsAccurate(string path, bool isDirectory) { var si = new SonosIdentifier {Path = path}; Assert.That(si.IsDirectory, Is.EqualTo(isDirectory)); }
public ResourceCollection(SonosIdentifier identifier) { Identifier = identifier; }
public ResourceCollection(SonosIdentifier identifier, IEnumerable <IRepresentAResource> enumerable) : this(identifier) { AddRange(enumerable); }