public void Ctor_String(string description) { var attribute = new TimersDescriptionAttribute(description); Assert.Equal(description, attribute.Description); Assert.Same(attribute.Description, attribute.Description); }
public void ExistingResourceName() { TimersDescriptionAttribute tda = new TimersDescriptionAttribute("TimerEnabled"); Assert.IsNotNull(tda.Description, "Description"); Assert.IsFalse("TimerEnabled" == tda.Description, "!Equal"); }
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); }
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); }
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 }
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); } }
public void AnyString() { TimersDescriptionAttribute tda = new TimersDescriptionAttribute("Mono"); Assert.IsNull(tda.Description, "Description"); }