|  | #region Copyright notice and license | 
|  | // Protocol Buffers - Google's data interchange format | 
|  | // Copyright 2015 Google Inc.  All rights reserved. | 
|  | // | 
|  | // Use of this source code is governed by a BSD-style | 
|  | // license that can be found in the LICENSE file or at | 
|  | // https://developers.google.com/open-source/licenses/bsd | 
|  | #endregion | 
|  |  | 
|  | using System; | 
|  | using System.Reflection; | 
|  | using Google.Protobuf.TestProtos; | 
|  | using NUnit.Framework; | 
|  | using UnitTest.Issues.TestProtos; | 
|  |  | 
|  | #pragma warning disable CS0612 // Type or member is obsolete | 
|  | namespace Google.Protobuf | 
|  | { | 
|  | public class DeprecatedMemberTest | 
|  | { | 
|  | private static void AssertIsDeprecated(MemberInfo member) | 
|  | { | 
|  | Assert.NotNull(member); | 
|  | Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); | 
|  | } | 
|  |  | 
|  | [Test] | 
|  | public void TestDeprecatedPrimitiveValue() => | 
|  | AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty(nameof(TestDeprecatedFields.DeprecatedInt32))); | 
|  |  | 
|  | [Test] | 
|  | public void TestDeprecatedMessage() => | 
|  | AssertIsDeprecated(typeof(DeprecatedChild)); | 
|  |  | 
|  | [Test] | 
|  | public void TestDeprecatedEnum() => | 
|  | AssertIsDeprecated(typeof(DeprecatedEnum)); | 
|  |  | 
|  | [Test] | 
|  | public void TestDeprecatedEnumValue() => | 
|  | AssertIsDeprecated(typeof(DeprecatedEnum).GetField(nameof(DeprecatedEnum.DeprecatedZero))); | 
|  | } | 
|  | } | 
|  | #pragma warning restore CS0612 // Type or member is obsolete |