// 构造函数初始化 public Player() { M_BasicProperty = new BasicProperty(); M_BattleProperty = new BattleProperty(); M_Equipments = new string[11]; M_Skills = new string[4]; }
public void Group_IterateProperties() { BasicGroup targetGroup = new BasicGroup(TestConstants.anID, TestConstants.aName); BasicProperty propertyAA = new BasicProperty("AA", "AA"); BasicProperty propertyBB = new BasicProperty("BB", "BB"); BasicProperty propertyCC = new BasicProperty("CC", "CC"); List <string> expectedIDs = new List <string>() { "CC", "BB", "AA" }; targetGroup.AddProperty(propertyCC); targetGroup.AddProperty(propertyBB); targetGroup.AddProperty(propertyAA); List <string> actualIds = new List <string>(); foreach (IProperty property in targetGroup.Properties) { actualIds.Add(property.Definition.ID); } Assert.AreEqual(expectedIDs.Count, actualIds.Count); for (int i = 0; i < expectedIDs.Count; i++) { Assert.AreEqual(expectedIDs[i], actualIds[i]); } }
protected override void Initialize() { scene = GetEnumProperty("scene", typeof(R.E.Scene)); controller = GetEnumProperty("controller", typeof(R.E.GameObject)); isActiveOnLoad = GetBasicProperty("isActiveOnLoad"); isStartedOnLoad = GetBasicProperty("isStartedOnLoad"); }
public void Property_Creation_ValidDefinition() { BasicPropertyDefinition fakeDef = new BasicPropertyDefinition("fakeId", "fakeName"); BasicProperty prop = new BasicProperty(fakeDef); Assert.AreEqual(fakeDef, prop.Definition); Assert.IsInstanceOfType(prop.Definition, fakeDef.GetType()); }
public void Provider_AddProperty() { BasicPropertiesProvider provider = new BasicPropertiesProvider(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); provider.AddProperty(aProperty); TestUtilities.checkForSingleItem(provider.Properties, aProperty, "Properties"); }
public void Group_AddProperty() { BasicGroup targetGroup = new BasicGroup(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); targetGroup.AddProperty(aProperty); TestUtilities.checkForSingleItem(targetGroup.Properties, aProperty, "Properties"); }
public void Property_Definition_Set() { BasicPropertyDefinition fakeDef = new BasicPropertyDefinition("fakeId", "fakeName"); BasicProperty prop = new BasicProperty(); prop.Definition = fakeDef; Assert.AreEqual(fakeDef, prop.Definition); }
protected override void Initialize() { world = target as World; scenes = GetListProperty("scenes"); activeScene = GetBasicProperty("activeScene"); mainScene = GetBasicProperty("mainScene"); isDeveloppement = GetBasicProperty("isDeveloppement"); }
public void Group_RemoveProperty_ByID() { BasicGroup targetGroup = new BasicGroup(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); targetGroup.AddProperty(aProperty); targetGroup.RemoveProperty(TestConstants.anID); TestUtilities.checkEmpty(targetGroup.Properties, "Properties"); }
public void Provider_RemoveProperty_ByID() { BasicPropertiesProvider provider = new BasicPropertiesProvider(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); provider.AddProperty(aProperty); provider.RemoveProperty(TestConstants.anID); TestUtilities.checkEmpty(provider.Properties, "Properties"); }
public void Property_Value_Set() { FakeValue fakeValue = new FakeValue(); BasicProperty prop = new BasicProperty(); prop.Value = fakeValue; Assert.AreEqual(fakeValue, prop.Value); Assert.IsInstanceOfType(prop.Value, fakeValue.GetType()); }
private IBasicProperties CreateBasicProperties(BasicProperty basicProperty) { var props = _channel.CreateBasicProperties(); props.Priority = basicProperty?.Priority ?? 0; props.CorrelationId = _correlationContext.CorrelationContext.CorrelationId; return(props); }
public void Property_Creation_Default() { BasicProperty prop = new BasicProperty(); // check the default values Assert.IsNotNull(prop.Definition, "BasicProperty default constructor should create a default property definition."); Assert.IsNull(prop.Value, "BasicProperty default construction should not have a value."); TestUtilities.checkDefaultPropertyDefinition(prop.Definition); }
public void Property_Creation_ValidNameAndID() { BasicProperty prop = new BasicProperty(TestConstants.anID, TestConstants.aName); Assert.IsNotNull(prop.Definition, "BasicProperty constructor should create a property definition."); Assert.AreEqual(TestConstants.anID, prop.Definition.ID); Assert.AreEqual(TestConstants.aName, prop.Definition.Name); Assert.IsNull(prop.Value, "BasicProperty default construction should not have a value."); }
private IBasicProperties CreateBasicProperties(BasicProperty basicProperty) { if (basicProperty == null) { return(null); } var props = _channel.CreateBasicProperties(); props.Priority = basicProperty.Priority; return(props); }
public void PublishMessage(string topic, string message, BasicProperty basicProperty = null) { if (!string.IsNullOrEmpty(message)) { _logger.LogDebug("Publish Message" + topic); _logger.LogDebug("[Reindexing] Exchange declare" + topic); _channel.ExchangeDeclare( exchange: _exchangeName, type: "topic", durable: false, autoDelete: false, arguments: null); var body = Encoding.UTF8.GetBytes(message); var basicProperties = CreateBasicProperties(basicProperty); _logger.LogDebug($"[Reindexing] Publish > CorrelationId = {basicProperties.CorrelationId}"); lock (_channel) { _channel.BasicPublish( exchange: _exchangeName, routingKey: topic, basicProperties: basicProperties, body: body); } _logger.LogDebug($"Published message to MQ topic {topic}"); } }
protected override void Initialize() { logo = GetLogo(); productNameProperty = GetProductNameProperty(); companyNameProperty = GetCompanyNameProperty(); startingScene = GetEnumProperty("startingScene", typeof(R.E.Scene)); utilitaryScenes = GetListProperty("utilitaryScenes"); tags = GetTagsProperty(); layers = GetLayersProperty(); physics2DLayerMatrixProperty = GetPhysics2DLayerMatrixProperty(); }
public void Property_Definition_SetNull() { BasicProperty prop = new BasicProperty(); ArgumentException expectedException = null; try { prop.Definition = null; } catch (ArgumentException e) { expectedException = e; } TestUtilities.checkException(expectedException, TestConstants.propDefinition, TestConstants.paramDefinition); }
public void Property_Creation_NullDefinition() { BasicProperty prop = null; ArgumentException expectedException = null; try { prop = new BasicProperty(null); } catch (ArgumentException e) { expectedException = e; } TestUtilities.checkException(expectedException, TestConstants.propDefinition, TestConstants.paramDefinition); Assert.IsNull(prop, "No property should be created."); }
public void createInvalidProperty(string id, string name, string propertyToTest, string parameterToTest) { BasicProperty prop = null; ArgumentException expectedException = null; try { prop = new BasicProperty(id, name); } catch (ArgumentException e) { expectedException = e; } TestUtilities.checkException(expectedException, propertyToTest, parameterToTest); Assert.IsNull(prop, "No property should be created."); }
public void Group_RemoveProperty_NonexistentProperty() { BasicGroup targetGroup = new BasicGroup(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); KeyNotFoundException expectedException = null; try { targetGroup.RemoveProperty(aProperty); } catch (KeyNotFoundException e) { expectedException = e; } Assert.IsNotNull(expectedException, "KeyNotFoundException not thrown"); TestUtilities.checkEmpty(targetGroup.Properties, "Properties"); }
public void Provider_RemoveProperty_NonexistentProperty() { BasicPropertiesProvider provider = new BasicPropertiesProvider(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); KeyNotFoundException expectedException = null; try { provider.RemoveProperty(aProperty); } catch (KeyNotFoundException e) { expectedException = e; } Assert.IsNotNull(expectedException, "KeyNotFoundException not thrown"); TestUtilities.checkEmpty(provider.Properties, "Properties"); }
public void Provider_AddProperty_Duplicate() { BasicPropertiesProvider provider = new BasicPropertiesProvider(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); ArgumentException expectedException = null; provider.AddProperty(aProperty); try { provider.AddProperty(aProperty); } catch (ArgumentException e) { expectedException = e; } TestUtilities.checkException(expectedException); TestUtilities.checkForSingleItem(provider.Properties, aProperty, "Properties"); }
public void Group_AddProperty_Duplicate() { BasicGroup targetGroup = new BasicGroup(TestConstants.anID, TestConstants.aName); BasicProperty aProperty = new BasicProperty(TestConstants.anID, TestConstants.aName); ArgumentException expectedException = null; targetGroup.AddProperty(aProperty); try { targetGroup.AddProperty(aProperty); } catch (ArgumentException e) { expectedException = e; } TestUtilities.checkException(expectedException); TestUtilities.checkForSingleItem(targetGroup.Properties, aProperty, "Properties"); }
private void OnDestroy() { scene = null; controller = null; isAlwaysVisible = null; }
public async Task Test() { //Encapsulate data var titlePropertyName = "Title"; var textValue = "AAA"; var titleProperty = new MultilingualProperty() { Description = new DefaultDescription() { Id = Guid.NewGuid(), IsCustom = false, PropertyName = titlePropertyName, DisplayName = new MultilingualString() { Text = textValue }, }, Value = new MultilingualString() { Text = textValue } }; var intPropertyName = "Integer"; int iValue = 5; var integerProperty = new BasicProperty <IntMedatadaDescription, IntegerType>() { Description = new IntMedatadaDescription() { Id = Guid.NewGuid(), IsCustom = false, PropertyName = intPropertyName, DisplayName = new MultilingualString() { Text = textValue }, }, Value = new IntegerType() { Value = iValue } }; var metadatas = new List <IProperty> { titleProperty, integerProperty }; var product = new Product(metadatas); // Extract data var title = product.GetPropertyValue <MultilingualString>(titlePropertyName); var unknow = product.GetPropertyValue <MultilingualString>("unknow"); var integerValue = product.GetPropertyValue <IntegerType>(intPropertyName); var wrongType = product.GetPropertyValue <IntegerType>(titlePropertyName); Assert.Null(unknow); Assert.Null(wrongType); Assert.True(title.Text == textValue); Assert.Equal(integerValue.Value, iValue); var newTitle = "Ten ten ten"; title.Text = newTitle; product.SetPropertyValue(titlePropertyName, title); title = product.GetPropertyValue <MultilingualString>(titlePropertyName); Assert.Equal(title.Text, newTitle); }
protected override void Initialize() { scene = GetEnumProperty("scene", typeof(R.E.Scene)); controller = GetEnumProperty("controller", typeof(R.E.GameObject)); isAlwaysVisible = GetBasicProperty("isAlwaysVisible"); }