// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // namespace MUnique.OpenMU.AttributeSystem.Tests; /// /// Tests for the . /// [TestFixture] public class SimpleElementTests { /// /// Tests if the value is 0 after creation. /// [Test] public void ValueIsNullAfterCreation() { var element = new SimpleElement(); Assert.That(element.Value, Is.EqualTo(0)); } /// /// Tests if the value returns the same as what has been set before. /// [Test] public void ValueIsSet() { const int elementValue = 4711; var element = new SimpleElement { Value = elementValue }; Assert.That(element.Value, Is.EqualTo(elementValue)); } /// /// Tests if the is called when the has been changed. /// [Test] public void ValueChangedEventWhenValueChanges() { var element = new SimpleElement(); bool eventCalled = false; element.ValueChanged += (sender, e) => eventCalled = true; element.Value = 6; Assert.That(eventCalled, Is.True); } /// /// Tests if the is called when the has been changed. /// [Test] public void ValueChangedEventWhenAggregateTypeChanges() { var element = new SimpleElement { Value = 0 }; bool eventCalled = false; element.ValueChanged += (sender, e) => eventCalled = true; element.AggregateType = AggregateType.AddFinal; Assert.That(eventCalled, Is.True); } }