public void DisplayObjectsFromNewObj_EmptyObject_ReturnsNoDisplayObjects() { var nonDisplayObjects = new List <BaseParameter.DisplayObject> { BaseParameter.DisplayObject.None }; var newObj = new BaseParameterImplementation(stub, stub); Assert.AreEqual(nonDisplayObjects, newObj.DisplayObjects); }
public void DisplayObjectsFromNewObj_EmptyObject_ReturnsAllDisplayObjects() { var allDisplayObjects = new List <BaseParameter.DisplayObject> { BaseParameter.DisplayObject.Signals, BaseParameter.DisplayObject.Parameters, }; var newObj = new BaseParameterImplementation(stub, stub, stub, allDisplayObjects); Assert.AreEqual(allDisplayObjects, newObj.DisplayObjects); }
public void AddDisplayObject_EmptyParameter_AddArgumentOrReplac( List <string> actualEnumNames, List <BaseParameter.DisplayObject> expected) { var newObject = new BaseParameterImplementation(stub, stub); foreach (var displayObject in actualEnumNames) { newObject.AddDisplayObject(displayObject); } Assert.AreEqual(expected, newObject.DisplayObjects); }
// Can't be tested yet, have to make DI //[TestCase("Param_Name", BaseParameter.ValueType.Parameter)] // Can be tested only for Bool parameters (this one is not bool) //[TestCase(true, BaseParameter.ValueType.Boolean)] public void CurrentValueType_NewObjectSetNewValue(string setValue, BaseParameter.ValueType expectedValueType) { string name = "Name"; string luaName = "LuaName"; Device.IDeviceManager deviceManager = GetMoqForSetValuesAndDisplayTextTest(); var parameter = new BaseParameterImplementation(luaName, name, string.Empty, null, deviceManager); parameter.SetNewValue(setValue); Assert.AreEqual(expectedValueType, parameter.CurrentValueType); }
public void SetValue_NewObject_ProcessValueReturnsCorrect( string setValue, string expectedValue) { string name = "Name"; string luaName = "LuaName"; Device.IDeviceManager deviceManager = GetMoqForSetValuesAndDisplayTextTest(); var parameter = new BaseParameterImplementation(luaName, name, stub, null, deviceManager); parameter.SetValue(setValue); Assert.AreEqual(expectedValue, parameter.Value); }
public void CreateObject_NoObject_ReturnsObject() { var obj = new BaseParameterImplementation(stub, stub); string[] expectedEditText = new string[] { obj.LuaName, obj.Value }; Assert.Multiple(() => { Assert.AreEqual(obj.LuaName, stub); Assert.AreEqual(obj.Name, stub); Assert.IsTrue(obj.IsUseDevList); Assert.IsFalse(obj.IsEmpty); Assert.IsNull(obj.Owner); Assert.AreEqual(expectedEditText, obj.EditText); Assert.AreEqual(obj.CurrentValueType, BaseParameter.ValueType.None); }); }
public void GetDisplayObjects_NewObject_ReturnsExpectedValues( List <BaseParameter.DisplayObject> displayObjects, Device.DeviceType[] expectedDevTypes, Device.DeviceSubType[] expectedDevSubTypes, bool expectedDisplayParameters) { var newObj = new BaseParameterImplementation(stub, stub, stub, displayObjects); newObj.GetDisplayObjects(out Device.DeviceType[] devTypes, out Device.DeviceSubType[] devSubTypes, out bool displayParameters); Assert.Multiple(() => { Assert.AreEqual(expectedDevTypes, devTypes); Assert.AreEqual(expectedDevSubTypes, devSubTypes); Assert.AreEqual(expectedDisplayParameters, displayParameters); }); }
public void DisplayText_NewObjectSetNewvalue_ReturnsCorrectDisplayText( string setValue, string expectedParameterValue) { string name = "Name"; string luaName = "LuaName"; Device.IDeviceManager deviceManager = GetMoqForSetValuesAndDisplayTextTest(); var parameter = new BaseParameterImplementation(luaName, name, stub, null, deviceManager); parameter.SetNewValue(setValue); var expectedDisplayText = new string[] { name, expectedParameterValue }; Assert.AreEqual(expectedDisplayText, parameter.DisplayText); }
public void Clone_EmptyObject_ReturnsTheSameButWithAnotherHash() { string name = "Name"; string luaName = "LuaName"; string defaultValue = "defaultValue"; var displayObjects = new List <BaseParameter.DisplayObject> { BaseParameter.DisplayObject.Parameters }; var obj = new BaseParameterImplementation(luaName, name, defaultValue, displayObjects); var cloned = obj.Clone(); Assert.Multiple(() => { Assert.AreNotEqual(cloned.GetHashCode(), obj.GetHashCode()); Assert.AreEqual(cloned.Name, obj.Name); Assert.AreEqual(cloned.LuaName, obj.LuaName); Assert.AreEqual(cloned.DefaultValue, obj.DefaultValue); Assert.AreEqual(cloned.DisplayObjects, obj.DisplayObjects); Assert.AreEqual(cloned.CurrentValueType, obj.CurrentValueType); }); }