public static void GetMinCapacityTest() { var instance = new DatabaseDataDescList(); var maxCapacity = instance.GetMinCapacity(); // 取得した値が容量最大値と一致すること Assert.AreEqual(maxCapacity, DatabaseDataDescList.MinCapacity); }
public static void SerializeTest() { var target = new DatabaseDataDescList(); target.AdjustLength(2); var clone = DeepCloner.DeepClone(target); Assert.IsTrue(clone.Equals(target)); }
public static void DataDescListGetterTest() { const int dataLength = 2; const int itemLength = 3; DatabaseDataDescList result = null; var instance = CreateTypeDesc(dataLength, itemLength); var changedPropertyList = new List <string>(); instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); }; var errorOccured = false; try { result = instance.DataDescList; } catch (Exception ex) { logger.Exception(ex); errorOccured = true; } // エラーが発生しないこと Assert.IsFalse(errorOccured); // 要素数がデータ数と一致すること Assert.AreEqual(result.Count, dataLength); // 各要素が意図した値と一致すること for (var i = 0; i < dataLength; i++) { Assert.AreEqual(result[i].DataName, MakeDataName(i)); Assert.AreEqual(result[i].ItemValueList.Count, itemLength); for (var j = 0; j < itemLength; j++) { Assert.AreEqual(result[i].ItemValueList[j], (DBItemValue)MakeItemValue(i, j)); } } // プロパティ変更通知が発火していないこと Assert.AreEqual(changedPropertyList.Count, 0); }
private void ReadDbData(FileReadStatus status, DBData data) { // データ数 var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataFileReader), "データ数数", length)); // DBデータ var dataDescList = new DatabaseDataDescList(); for (var i = 0; i < length; i++) { var desc = new DatabaseDataDesc(); // データ名 var dataName = status.ReadString(); status.AddOffset(dataName.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataFileReader), "データ名", dataName.String)); desc.DataName = dataName.String; // 数値項目 ReadDbDataIntValues(status, out var intValues); desc.ItemValueList.AddRange(intValues); // 文字列項目 ReadDbDataStringValues(status, out var stringValues); desc.ItemValueList.AddRange(stringValues); dataDescList.Overwrite(i, new List <DatabaseDataDesc> { desc }); } data.DataDescList.Overwrite(0, dataDescList); }
async Task InitializeMapData(string dataPath) { DatabaseDataDescList mapSettingList = CoreData.Instance.systemDB.GetDataDescList(0); CoreData.Instance.mapEventCurrentPages = new int[mapSettingList.Count][]; CoreData.Instance.mapDataArray = new MapData[mapSettingList.Count]; CoreData.Instance.mapVariables = new int[mapSettingList.Count][][]; for (int i = 0; i < mapSettingList.Count; i++) { string mapPath = dataPath + mapSettingList[i].ItemValueList[0].StringValue.ToString(); var mpsReader = new MpsFileReader(); MapData mapData = await mpsReader.ReadFileAsync(mapPath); CoreData.Instance.mapDataArray[i] = mapData; CoreData.Instance.mapEventCurrentPages[i] = new int[mapData.MapEvents.Count]; CoreData.Instance.mapVariables[i] = new int[mapData.MapEvents.Count][]; for (int j = 0; j < mapData.MapEvents.Count; j++) { CoreData.Instance.mapVariables[i][j] = new int[10]; } } }
void InitializeCurrentMapID() { DatabaseDataDescList posSettingList = CoreData.Instance.systemDB.GetDataDescList(7); CoreData.Instance.currentMapID = posSettingList[0].ItemValueList[0].IntValue; }