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"));
        }
Example #2
0
        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;
        }
Example #3
0
 public static PhysicalResource FromId(SonosIdentifier identifier)
 {
     return identifier.IsDirectory 
         ? (PhysicalResource) new Container(identifier) 
         : new MusicFile(identifier);
 }
Example #4
0
 protected PhysicalResource(SonosIdentifier identifier)
 {
     Identifier = identifier;
 }
        public void CreatedWithAPath_IsDirectoryIsAccurate(string path, bool isDirectory)
        {
            var si = new SonosIdentifier {Path = path};

            Assert.That(si.IsDirectory, Is.EqualTo(isDirectory));
        }