public void CanAddAnEqualFilePath()
        {
            string filePath = this.GivenAStandardFilePath();

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            Assert.IsTrue(assetAndroid.CanBeAdded(filePath));
        }
        public void ThrowExceptionIfIsCreatedWithEmptyFilePath()
        {
            string filePath = string.Empty;

            Assert.Throws <ArgumentException>(() =>
            {
                AssetAndroid assetAndroid = new AssetAndroid(filePath);
            });
        }
        public void CanAddAnotherSizeOfFilePath()
        {
            string filePath   = this.GivenAStandardFilePath();
            string x2FilePath = this.GivenALdpiFilePath();

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            Assert.IsTrue(assetAndroid.CanBeAdded(x2FilePath));
        }
        public void CanNotAddDifferentFilePath()
        {
            string filePath      = this.GivenAStandardFilePath();
            string otherFilePath = this.GivenAStandardFilePath("otherFile");

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            Assert.IsFalse(assetAndroid.CanBeAdded(otherFilePath));
        }
        public void CreateAssetWithXhdpiFile()
        {
            string filePath = this.GivenAXhdpiFilePath();

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            Assert.IsNull(assetAndroid.StandardFilePath);
            Assert.IsNull(assetAndroid.LdpiFilePath);
            Assert.IsNull(assetAndroid.MdpiFilePath);
            Assert.IsNull(assetAndroid.HdpiFilePath);
            Assert.That(assetAndroid.XhdpiFilePath, Is.EqualTo(filePath));
            Assert.IsNull(assetAndroid.XxhdpiFilePath);
            Assert.IsNull(assetAndroid.XxxhdpiFilePath);
        }
        public void AddAnEqualFilePath()
        {
            string filePath = this.GivenAStandardFilePath();

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            var result = assetAndroid.Add(filePath);

            Assert.IsTrue(result);

            Assert.That(assetAndroid.StandardFilePath, Is.EqualTo(filePath));
            Assert.IsNull(assetAndroid.LdpiFilePath);
            Assert.IsNull(assetAndroid.MdpiFilePath);
            Assert.IsNull(assetAndroid.HdpiFilePath);
            Assert.IsNull(assetAndroid.XhdpiFilePath);
            Assert.IsNull(assetAndroid.XxhdpiFilePath);
            Assert.IsNull(assetAndroid.XxxhdpiFilePath);
        }
        public void NotAddDifferentFilePath()
        {
            string filePath      = this.GivenAStandardFilePath();
            string otherFilePath = this.GivenAStandardFilePath("otherFile");

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            var result = assetAndroid.Add(otherFilePath);

            Assert.IsFalse(result);

            Assert.That(assetAndroid.StandardFilePath, Is.EqualTo(filePath));
            Assert.IsNull(assetAndroid.LdpiFilePath);
            Assert.IsNull(assetAndroid.MdpiFilePath);
            Assert.IsNull(assetAndroid.HdpiFilePath);
            Assert.IsNull(assetAndroid.XhdpiFilePath);
            Assert.IsNull(assetAndroid.XxhdpiFilePath);
            Assert.IsNull(assetAndroid.XxxhdpiFilePath);
        }
Ejemplo n.º 8
0
        private void FillAllAssets()
        {
            this.assets.Clear();
            foreach (var project in solution.GetAllProjects().Where(p => p.IsIOSProject()))
            {
                var resourcesFolder = Path.Combine(project.BaseDirectory, "Resources");
                var resources       = FileUtils.GetFolderImages(resourcesFolder);

                List <AssetiOS> iosAssets = new List <AssetiOS>();
                foreach (var resource in resources)
                {
                    var asset = iosAssets.FirstOrDefault(a => a.CanBeAdded(resource));
                    if (asset == null)
                    {
                        asset = new AssetiOS(resource);
                        iosAssets.Add(asset);
                    }
                    asset.Add(resource);
                }

                this.assets.AddRange(iosAssets.Select(a => new AssetProperties(a, project)));
            }

            foreach (var project in solution.GetAllProjects().Where(p => p.IsAndroidProject()))
            {
                var resources = GetAndroidImageResources(project);

                List <AssetAndroid> androidAssets = new List <AssetAndroid>();
                foreach (var resource in resources)
                {
                    var asset = androidAssets.FirstOrDefault(a => a.CanBeAdded(resource));
                    if (asset == null)
                    {
                        asset = new AssetAndroid(resource);
                        androidAssets.Add(asset);
                    }
                    asset.Add(resource);
                }

                this.assets.AddRange(androidAssets.Select(a => new AssetProperties(a, project)));
            }
        }
        public void AddMultipleSizesOfFilePath()
        {
            string filePath       = this.GivenAStandardFilePath();
            string ldpiFilePath   = this.GivenALdpiFilePath();
            string xxHdpiFilePath = this.GivenAXxhdpiFilePath();

            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            assetAndroid.Add(ldpiFilePath);
            var result = assetAndroid.Add(xxHdpiFilePath);

            Assert.IsTrue(result);

            Assert.That(assetAndroid.StandardFilePath, Is.EqualTo(filePath));
            Assert.That(assetAndroid.LdpiFilePath, Is.EqualTo(ldpiFilePath));
            Assert.IsNull(assetAndroid.MdpiFilePath);
            Assert.IsNull(assetAndroid.HdpiFilePath);
            Assert.IsNull(assetAndroid.XhdpiFilePath);
            Assert.That(assetAndroid.XxhdpiFilePath, Is.EqualTo(xxHdpiFilePath));
            Assert.IsNull(assetAndroid.XxxhdpiFilePath);
        }
Ejemplo n.º 10
0
 public AndroidContainsLdpiFileCondition(AssetAndroid assetAndroid)
 {
     this.assetAndroid = assetAndroid;
 }
 public DrawableAssetAndroidCondition(AssetAndroid assetAndroid)
 {
     this.assetAndroid = assetAndroid;
 }
 public AllFilesAndroidCondition(AssetAndroid assetAndroid)
 {
     this.assetAndroid = assetAndroid;
 }
        public void CreateIdentifierFromFilePath(string filePath)
        {
            AssetAndroid assetAndroid = new AssetAndroid(filePath);

            Assert.That(assetAndroid.Identifier, Is.EqualTo("dummyfile"));
        }
 public AndroidContainsStandardFileCondition(AssetAndroid assetAndroid)
 {
     this.assetAndroid = assetAndroid;
 }