コード例 #1
0
ファイル: ApplicationIdTests.cs プロジェクト: dotnet/corefx
 public void Properties()
 {
     byte[] token = {1,2,3,4,5};
     var id = new ApplicationId(token, "Pizza", new Version(1, 0), "pepperoni", "it-it");
     CheckId(id, token);
     CheckId(id.Copy(), token);
 }
コード例 #2
0
ファイル: ApplicationId.cs プロジェクト: randomize/VimConfig
        public override bool Equals(object o)
        {
            ApplicationId id = o as ApplicationId;

            if (id == null)
            {
                return(false);
            }
            if ((!object.Equals(this.m_name, id.m_name) || !object.Equals(this.m_version, id.m_version)) || (!object.Equals(this.m_processorArchitecture, id.m_processorArchitecture) || !object.Equals(this.m_culture, id.m_culture)))
            {
                return(false);
            }
            if (this.m_publicKeyToken.Length != id.m_publicKeyToken.Length)
            {
                return(false);
            }
            for (int i = 0; i < this.m_publicKeyToken.Length; i++)
            {
                if (this.m_publicKeyToken[i] != id.m_publicKeyToken[i])
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #3
0
        public override bool Equals(Object o)
        {
            ApplicationId other = (o as ApplicationId);

            if (other == null)
            {
                return(false);
            }

            if (!(Equals(this.m_name, other.m_name) &&
                  Equals(this.m_version, other.m_version) &&
                  Equals(this.m_processorArchitecture, other.m_processorArchitecture) &&
                  Equals(this.m_culture, other.m_culture)))
            {
                return(false);
            }

            if (this.m_publicKeyToken.Length != other.m_publicKeyToken.Length)
            {
                return(false);
            }

            for (int i = 0; i < this.m_publicKeyToken.Length; ++i)
            {
                if (this.m_publicKeyToken[i] != other.m_publicKeyToken[i])
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        public void Properties()
        {
            byte[] token = { 1, 2, 3, 4, 5 };
            var    id    = new ApplicationId(token, "Pizza", new Version(1, 0), "pepperoni", "it-it");

            CheckId(id, token);
            CheckId(id.Copy(), token);
        }
コード例 #5
0
        public void ToStringTest()
        {
            byte[] token = { 1, 2, 3, 4, 5 };
            var    id    = new ApplicationId(token, "Pizza", new Version(1, 0), "pepperoni", "it-it");

            Assert.Equal(
                "Pizza, culture=\"it-it\", version=\"1.0\", publicKeyToken=\"0102030405\", processorArchitecture =\"pepperoni\"",
                id.ToString());
        }
コード例 #6
0
ファイル: ApplicationIdTest.cs プロジェクト: nlhepler/mono
		public void ApplicationId_ProcessorArchitectureNull ()
		{
			ApplicationId id = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, null, defaultCulture);
			// wait for NUnit 2.2 Assert.AreEqual (defaultPublicKeyToken, id.PublicKeyToken, "PublicKeyToken");
			Assert.AreEqual (defaultName, id.Name, "Name");
			Assert.AreEqual (defaultVersion, id.Version, "Version");
			Assert.IsNull (id.ProcessorArchitecture, "ProcessorArchitecture");
			Assert.AreEqual (defaultCulture, id.Culture, "Culture");
			Assert.AreEqual ("name, culture=\"culture\", version=\"1.0.0.0\", publicKeyToken=\"\"", id.ToString (), "ToString");
		}
コード例 #7
0
ファイル: ApplicationIdTests.cs プロジェクト: dotnet/corefx
 private void CheckId(ApplicationId id, byte[] token)
 {
     Assert.Equal("Pizza", id.Name);
     Assert.Equal(new Version(1, 0), id.Version);
     Assert.Equal("pepperoni", id.ProcessorArchitecture);
     Assert.Equal("it-it", id.Culture);
     byte[] pk = id.PublicKeyToken;
     Assert.Equal(token, pk);
     Assert.NotSame(token, pk);
     Assert.NotSame(pk, id.PublicKeyToken);
 }
コード例 #8
0
 private void CheckId(ApplicationId id, byte[] token)
 {
     Assert.Equal("Pizza", id.Name);
     Assert.Equal(new Version(1, 0), id.Version);
     Assert.Equal("pepperoni", id.ProcessorArchitecture);
     Assert.Equal("it-it", id.Culture);
     byte[] pk = id.PublicKeyToken;
     Assert.Equal(token, pk);
     Assert.NotSame(token, pk);
     Assert.NotSame(pk, id.PublicKeyToken);
 }
コード例 #9
0
ファイル: applicationid.cs プロジェクト: wwkkww1983/ZJCredit
        /// <summary>确定指定的 <see cref="T:System.ApplicationId" /> 对象是否等效于当前 <see cref="T:System.ApplicationId" />。</summary>
        /// <returns>如果指定的 <see cref="T:System.ApplicationId" /> 对象等效于当前 <see cref="T:System.ApplicationId" />,则为 true;否则为 false。</returns>
        /// <param name="o">要与当前 <see cref="T:System.ApplicationId" /> 进行比较的 <see cref="T:System.ApplicationId" /> 对象。</param>
        /// <filterpriority>2</filterpriority>
        public override bool Equals(object o)
        {
            ApplicationId applicationId = o as ApplicationId;

            if (applicationId == null || !object.Equals((object)this.m_name, (object)applicationId.m_name) || (!object.Equals((object)this.m_version, (object)applicationId.m_version) || !object.Equals((object)this.m_processorArchitecture, (object)applicationId.m_processorArchitecture)) || (!object.Equals((object)this.m_culture, (object)applicationId.m_culture) || this.m_publicKeyToken.Length != applicationId.m_publicKeyToken.Length))
            {
                return(false);
            }
            for (int index = 0; index < this.m_publicKeyToken.Length; ++index)
            {
                if ((int)this.m_publicKeyToken[index] != (int)applicationId.m_publicKeyToken[index])
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #10
0
ファイル: ApplicationId.cs プロジェクト: ForNeVeR/pnet
        // Determine if two objects are equal.
        public override bool Equals(Object o)
        {
            ApplicationId other = (o as ApplicationId);

            if (other != null)
            {
                if (strName != other.strName ||
                    strProcessorArchitecture !=
                    other.strProcessorArchitecture ||
                    strCulture != other.strCulture ||
                    version != other.version)
                {
                    return(false);
                }
                if (publicKeyToken == null)
                {
                    return(other.publicKeyToken == null);
                }
                else if (other.publicKeyToken == null ||
                         publicKeyToken.Length !=
                         other.publicKeyToken.Length)
                {
                    return(false);
                }
                else
                {
                    int posn;
                    for (posn = 0; posn < publicKeyToken.Length; ++posn)
                    {
                        if (publicKeyToken[posn] !=
                            other.publicKeyToken[posn])
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #11
0
        public override bool Equals(object o)
        {
            if (o == null)
            {
                return(false);
            }
            ApplicationId appid = (o as ApplicationId);

            if (appid == null)
            {
                return(false);
            }
            if (_name != appid._name)
            {
                return(false);
            }
            if (_proc != appid._proc)
            {
                return(false);
            }
            if (_culture != appid._culture)
            {
                return(false);
            }
            if (!_version.Equals(appid._version))
            {
                return(false);
            }
            if (_token.Length != appid._token.Length)
            {
                return(false);
            }
            for (int i = 0; i < _token.Length; i++)
            {
                if (_token [i] != appid._token [i])
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #12
0
ファイル: ApplicationIdTest.cs プロジェクト: nlhepler/mono
		public void Equals ()
		{
			ApplicationId id1 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			ApplicationId id2 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			Assert.IsTrue (id1.Equals (id2), "Equals-1");
			Assert.IsTrue (id2.Equals (id1), "Equals-2");
			Assert.AreEqual (id1.GetHashCode (), id2.GetHashCode (), "GetHashCode");
		}
コード例 #13
0
 public void Kapat(ApplicationId app)
 {
 }
コード例 #14
0
ファイル: ApplicationIdTest.cs プロジェクト: nlhepler/mono
		public void ToString_ ()
		{
			byte[] token = new byte [256];
			for (int i=0; i < token.Length; i++)
				token [i] = (byte)i;
			ApplicationId id = new ApplicationId (token, "Mono", new Version (1, 2), "Multiple", "neutral");
			Assert.AreEqual ("Mono, culture=\"neutral\", version=\"1.2\", publicKeyToken=\"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF\", processorArchitecture =\"Multiple\"", id.ToString (), "ToString");
		}
コード例 #15
0
ファイル: ApplicationIdTest.cs プロジェクト: nlhepler/mono
		public void Equals_Subset ()
		{
			ApplicationId id1 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			ApplicationId id2 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, null, defaultCulture);
			Assert.IsFalse (id1.Equals (id2), "Equals-A1");
			Assert.IsFalse (id2.Equals (id1), "Equals-A2");
			// would have expected IsFalse
			Assert.IsTrue (id1.GetHashCode () == id2.GetHashCode (), "GetHashCode-A");

			ApplicationId id3 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, null);
			Assert.IsFalse (id1.Equals (id3), "Equals-B1");
			Assert.IsFalse (id3.Equals (id1), "Equals-B2");
			// would have expected IsFalse
			Assert.IsTrue (id1.GetHashCode () == id3.GetHashCode (), "GetHashCode-B");
		}
コード例 #16
0
ファイル: ApplicationIdTest.cs プロジェクト: nlhepler/mono
		public void PublicKeyToken ()
		{
			byte[] token = new byte [1];
			ApplicationId id = new ApplicationId (token, defaultName, defaultVersion, null, null);
			token = id.PublicKeyToken;
			Assert.AreEqual (0, token [0], "PublicKeyToken");
			token [0] = 1;
			Assert.AreEqual (1, token [0], "token");
			token = id.PublicKeyToken;
			Assert.AreEqual (0, token [0], "PublicKeyToken");
		}
コード例 #17
0
ファイル: ApplicationIdTest.cs プロジェクト: nlhepler/mono
		public void Copy () 
		{
			ApplicationId id1 = new ApplicationId (defaultPublicKeyToken, defaultName, defaultVersion, defaultProc, defaultCulture);
			ApplicationId id2 = id1.Copy ();
			Assert.IsTrue (id1.Equals (id2), "Equals-1");
			Assert.IsTrue (id2.Equals (id1), "Equals-2");
			Assert.IsFalse (Object.ReferenceEquals (id1, id2), "ReferenceEquals");
		}