Esempio n. 1
0
        public override bool Equals(object obj)
        {
            TemplateSource other = obj as TemplateSource;

            if (other == null)
            {
                return(false);
            }
            if (Type != other.Type)
            {
                return(false);
            }

            if (SourceFolder != null && !SourceFolder.Equals(other.SourceFolder))
            {
                return(false);
            }

            if (GitUrl != null && !GitUrl.Equals(other.GitUrl))
            {
                return(false);
            }

            if (PackageVersion != null && !PackageVersion.Equals(other.PackageVersion))
            {
                return(false);
            }

            if (PackageName != null && !PackageName.Equals(other.PackageName))
            {
                return(false);
            }

            return(true);
        }
        public void IfTwoClassesWithOneClassNotAPackageVersionAreNotEqual()
        {
            var package1 = new PackageVersion();
            var package2 = new Object();

            package1.Name = "test";
            Assert.IsFalse(package1.Equals(package2));
        }
        public void IfTwoClassesWithDifferentNamesAreNotEqual()
        {
            var package1 = new PackageVersion();
            var package2 = new PackageVersion();

            package1.Name = "test";
            package2.Name = "test2";
            Assert.IsFalse(package1.Equals(package2));
        }
        public void IfTwoClassesWithTheSameNameAreEqual()
        {
            var package1 = new PackageVersion();
            var package2 = new PackageVersion();

            package1.Name = "test";
            package2.Name = "test";
            Assert.IsTrue(package1.Equals(package2));
        }
Esempio n. 5
0
        public bool Equals(Dependency other)
        {
            if (this == other)
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }
            bool areequal = string.Equals(this.Name, other.Name);

            areequal = areequal && this.IsOptional == other.IsOptional;
            areequal = areequal && PackageVersion.Equals(this.Version, other.Version);
            return(areequal);
        }
Esempio n. 6
0
        public void EqualsTest()
        {
            var result = _packageVersion.Equals(new PackageVersion(Version));

            Assert.IsTrue(result);
        }