コード例 #1
0
        public void Ctor_String(string description)
        {
            var attribute = new TimersDescriptionAttribute(description);

            Assert.Equal(description, attribute.Description);
            Assert.Same(attribute.Description, attribute.Description);
        }
コード例 #2
0
        public void ExistingResourceName()
        {
            TimersDescriptionAttribute tda = new TimersDescriptionAttribute("TimerEnabled");

            Assert.IsNotNull(tda.Description, "Description");
            Assert.IsFalse("TimerEnabled" == tda.Description, "!Equal");
        }
コード例 #3
0
        public void Ctor_String_String()
        {
            PropertyInfo autoResetProperty       = typeof(Timer).GetProperty(nameof(Timer.AutoReset));
            TimersDescriptionAttribute attribute = autoResetProperty.GetCustomAttribute <TimersDescriptionAttribute>();

            Assert.NotEmpty(attribute.Description);
            Assert.Same(attribute.Description, attribute.Description);
        }
コード例 #4
0
        public void Description_GetWithNullDescription_ThrowsArgumentNullException()
        {
            var attribute = new TimersDescriptionAttribute(null);

            AssertExtensions.Throws <ArgumentNullException>("format", "name", () => attribute.Description);

            // Only the first call fails.
            Assert.Null(attribute.Description);
        }
コード例 #5
0
        public void Constructor_Deny_Unrestricted()
        {
            TimersDescriptionAttribute tda = new TimersDescriptionAttribute("Mono");

            // Note: see unit tests for why we're not expecting "Mono" as the value
            Assert.AreEqual(tda.Description, tda.Description, "Description");
            // this assert doesn't do anything (except removing warning) but we know,
            // for CAS, that nothing protects the property getter
        }
コード例 #6
0
        public void Ctor_String(string description)
        {
            var attribute = new TimersDescriptionAttribute(description);

            if (PlatformDetection.IsFullFramework)
            {
                Assert.Null(attribute.Description);
            }
            else
            {
                Assert.Equal(description, attribute.Description);
                Assert.Same(attribute.Description, attribute.Description);
            }
        }
コード例 #7
0
        public void AnyString()
        {
            TimersDescriptionAttribute tda = new TimersDescriptionAttribute("Mono");

            Assert.IsNull(tda.Description, "Description");
        }