mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-07-31 15:58:27 -04:00
* Move all unit tests to Engine/Tests * Fix Margin.EdgeSubtract * Fix Capsule.Contains * EnvironmentVariables.Remove if it's null * Fixed ray trace never returning startedsolid * Fix HistoryList.Navigate on empty list * Fix GameObject.WorldPosition accepting NaNs * Fix flex: initial expanding to the wrong grow/shrink * Translation.TryConvert shouldn't throw on invalid enum strings * Skip sound file tests on machines with no audio device
34 lines
774 B
C#
34 lines
774 B
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace BindTests;
|
|
|
|
[TestClass]
|
|
public class FindAttributesTest
|
|
{
|
|
[TestMethod]
|
|
public void Simple()
|
|
{
|
|
var target = new BindingTarget
|
|
{
|
|
Primary = "Dog",
|
|
Secondary = "Cat"
|
|
};
|
|
var bind = new Sandbox.Bind.BindSystem( "test" );
|
|
bind.Build.Set( target, nameof( BindingTarget.Primary ) ).From( target, nameof( BindingTarget.Secondary ) );
|
|
|
|
var attributes = bind.FindAttributes( target, nameof( BindingTarget.Primary ) );
|
|
Assert.IsNotNull( attributes );
|
|
Assert.AreEqual( 1, attributes.Length );
|
|
}
|
|
|
|
private sealed class BindingTarget
|
|
{
|
|
public string Primary { get; set; }
|
|
|
|
[Display( Name = "Secondary" )]
|
|
public string Secondary { get; set; }
|
|
}
|
|
|
|
}
|