public void TestPartyMemberList() { var leader = new Mobile(0x1024u); leader.DefaultMobileInit(); var member = new Mobile(0x2048u); member.DefaultMobileInit(); var p = new Party(leader); p.Add(member); var expected = new PartyMemberList(p).Compile(); var ns = PacketTestUtilities.CreateTestNetState(); ns.SendPartyMemberList(p); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }
public void GetInstance_WithoutLifetimeScope_ThrowsExpectedException() { // Arrange var container = new Container(); container.Register <ICommand, ConcreteCommand>(new ThreadScopedLifestyle()); try { // Act var firstInstance = container.GetInstance <ICommand>(); // Assert Assert.Fail("Exception expected."); } catch (ActivationException ex) { AssertThat.ExceptionMessageContains(@" The ConcreteCommand is registered as 'Thread Scoped' lifestyle, but the instance is requested outside the context of an active (Thread Scoped) scope." .TrimInside(), ex); } }
public void TestDisplayProfile(string header, string body, string footer) { Serial m = 0x1000; var data = new DisplayProfile(m, header, body, footer).Compile(); header ??= ""; body ??= ""; footer ??= ""; var length = 12 + header.Length + footer.Length * 2 + body.Length * 2; Span <byte> expectedData = stackalloc byte[length]; var pos = 0; expectedData.Write(ref pos, (byte)0xB8); // Packet ID expectedData.Write(ref pos, (ushort)length); // Length expectedData.Write(ref pos, m); // Mobile Serial or Serial.Zero expectedData.WriteAsciiNull(ref pos, header); expectedData.WriteBigUniNull(ref pos, footer); expectedData.WriteBigUniNull(ref pos, body); AssertThat.Equal(data, expectedData); }
public void TestSkillUpdate() { var m = new Mobile(0x1); m.DefaultMobileInit(); var skills = m.Skills; m.Skills[SkillName.Alchemy].BaseFixedPoint = 1000; // GM Alchemy var data = new SkillUpdate(skills).Compile(); var length = 6 + skills.Length * 9; Span <byte> expectedData = stackalloc byte[length]; var pos = 0; expectedData.Write(ref pos, (byte)0x3A); // Packet ID expectedData.Write(ref pos, (ushort)length); // Length expectedData.Write(ref pos, (byte)0x02); // type: absolute, capped for (var i = 0; i < skills.Length; i++) { var s = skills[i]; var v = s.NonRacialValue; var uv = Math.Clamp((int)(v * 10), 0, 0xFFFF); expectedData.Write(ref pos, (ushort)(s.Info.SkillID + 1)); expectedData.Write(ref pos, (ushort)uv); expectedData.Write(ref pos, (ushort)s.BaseFixedPoint); expectedData.Write(ref pos, (byte)s.Lock); expectedData.Write(ref pos, (ushort)s.CapFixedPoint); } AssertThat.Equal(data, expectedData); }
public void TestServerChange() { var p = new Point3D(100, 1000, 1); var map = Map.Felucca; var data = new ServerChange(p, map).Compile(); Span <byte> expectedData = stackalloc byte[16]; var pos = 0; expectedData.Write(ref pos, (byte)0x76); // Packet ID expectedData.Write(ref pos, (ushort)p.X); expectedData.Write(ref pos, (ushort)p.Y); expectedData.Write(ref pos, (short)p.Z); #if NO_LOCAL_INIT expectedData.Write(ref pos, (byte)0); // Unknown expectedData.Write(ref pos, 0); // Server X, Server Y #else pos += 5; #endif expectedData.Write(ref pos, (ushort)map.Width); // Server Width expectedData.Write(ref pos, (ushort)map.Height); // Server Height AssertThat.Equal(data, expectedData); }
public void TestTargetReq() { var t = new TestTarget(10, true, TargetFlags.Beneficial); var data = new TargetReq(t).Compile(); Span <byte> expectedData = stackalloc byte[19]; var pos = 0; expectedData.Write(ref pos, (byte)0x6C); // Packet ID expectedData.Write(ref pos, t.AllowGround); expectedData.Write(ref pos, t.TargetID); expectedData.Write(ref pos, (byte)t.Flags); #if NO_LOCAL_INIT expectedData.Write(ref pos, 0); expectedData.Write(ref pos, (ushort)0); expectedData.Write(ref pos, (ushort)0); expectedData.Write(ref pos, (byte)0); expectedData.Write(ref pos, (byte)0); expectedData.Write(ref pos, (ushort)0); #endif AssertThat.Equal(data, expectedData); }
public IPlugin GetPlugin(string name) { AssertThat.IsNotNullOrEmpty(name); return(plugins[name]); }
private void ProcessData(string path, DataInfo.Data clzData) { AssertThat.IsTrue(File.Exists(path), "Excel file can not find"); var excelApp = new Application(); var workbooks = excelApp.Workbooks.Open(path); try { int pageCount = workbooks.Sheets.Count; AssertThat.IsTrue(pageCount > 2, "Excel's page count MUST > 2"); for (int pageIndex = 3; pageIndex <= pageCount; pageIndex++) { var sheet = workbooks.Sheets[pageIndex]; AssertThat.IsNotNull(sheet, "Excel's sheet is null"); Worksheet worksheet = sheet as Worksheet; AssertThat.IsNotNull(sheet, "Excel's worksheet is null"); var usedRange = worksheet.UsedRange; int rowCount = usedRange.Rows.Count; int colCount = usedRange.Columns.Count; if (rowCount < 2) { Log.Info($"{clzData.ExcelName}.xlsx的第{pageIndex}页无数据,跳过..."); continue; } for (int rowIndex = 2; rowIndex <= rowCount; rowIndex++) { var excel_Type = _listClzIns.GetType(); var dataProp = excel_Type.GetProperty("List"); var dataIns = dataProp.GetValue(_listClzIns); var dataType = dataProp.PropertyType; var ins = _assembly.CreateInstance($"{clzData.PkgName}.{clzData.DataClzName}"); var addMethod = dataType.GetMethod("Add", new[] { ins.GetType() }); for (int columnIndex = 1; columnIndex <= colCount; columnIndex++) { string variableName = ((Range)usedRange.Cells[1, columnIndex]).Text.ToString(); if (string.IsNullOrEmpty(variableName)) { continue; } var variableType = clzData.VarType[variableName]; var variableValue = ((Range)usedRange.Cells[rowIndex, columnIndex]).Text.ToString(); var insType = ins.GetType(); var fieldNameSplit = variableName.Split('_');// .Replace("_", "") + "_"; string fieldName = ""; for (int i = 0; i < fieldNameSplit.Length; i++) { fieldName += fieldNameSplit[i].Substring(0, 1).ToUpper() + fieldNameSplit[i].Substring(1); } fieldName = fieldName.Substring(0, 1).ToLower() + fieldName.Substring(1) + "_"; FieldInfo insField = insType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance); if (insField == null) { Log.Info($"{clzData.DataClzName}中找不到列{variableName}对应的属性{fieldName}"); continue; } var value = GetVariableValue(variableType, variableValue); insField.SetValue(ins, value); } addMethod.Invoke(dataIns, new[] { ins }); } Log.Info($"{clzData.ExcelName}.xlsx的第{pageIndex}页有{rowCount - 1}条数据,导出完毕"); } Serialize(_listClzIns); } catch (Exception e) { Console.WriteLine(e); throw; } finally { workbooks.Close(); excelApp.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp); } }
public void AssertUserIsNotLoggedIn(String firstName) { AssertThat .Element(homePage.GetHeaderFragment().GetMyProfileButton()) .HasVisibility(false); }
public void Can_Create_A_Simple_Organization() { OrganizationCreator.CreateSimpleOrganization(); AssertThat.IsTrue(OrganizationCreator.FirstOrganization.IsOrganizationCreatedSuccessfully, "Organization was not created successfully but it should"); AssertThat.IsTrue(OrganizationCreator.FirstOrganization.AreOrganizationFieldValuesSavedCorrectly, "Organization field values where not saved correctly"); }
public void Can_Create_A_Simple_Contact() { ContactCreator.CreateSimpleContact(); AssertThat.IsTrue(ContactCreator.FirstContact.IsContactCreatedSuccessfully, "Contact was not created successfully but it should"); AssertThat.IsTrue(ContactCreator.FirstContact.AreContactFieldValuesSavedCorrectly, "Contact field values where not saved correctly"); }
public void TestMobileIncoming( ProtocolChanges protocolChanges, int hairItemId, int hairHue, int facialHairItemId, int facialHairHue ) { var beholder = new Mobile(0x1) { Name = "Random Mobile 1" }; beholder.DefaultMobileInit(); var beheld = new Mobile(0x2) { Name = "Random Mobile 2" }; beheld.DefaultMobileInit(); beheld.AddItem( new Item((Serial)0x1000) { Layer = Layer.OneHanded } ); // Test Dupe beheld.AddItem( new Item((Serial)0x1001) { Layer = Layer.OneHanded } ); beheld.HairItemID = hairItemId; beheld.HairHue = hairHue; beheld.FacialHairItemID = facialHairItemId; beheld.FacialHairHue = facialHairHue; var ns = new NetState(null) { ProtocolChanges = protocolChanges }; var data = new MobileIncoming(ns, beholder, beheld).Compile(); var sa = ns.StygianAbyss; var newPacket = ns.NewMobileIncoming; var itemIdMask = newPacket ? 0xFFFF : 0x7FFF; Span <bool> layers = stackalloc bool[256]; #if NO_LOCAL_INIT layers.Clear(); #endif var items = beheld.Items; var count = items.Count; if (beheld.HairItemID > 0) { count++; } if (beheld.FacialHairItemID > 0) { count++; } var length = 23 + count * 9; // Max Size Span <byte> expectedData = stackalloc byte[length]; var pos = 0; expectedData.Write(ref pos, (byte)0x78); pos += 2; // Length var isSolidHue = beheld.SolidHueOverride >= 0; expectedData.Write(ref pos, beheld.Serial); expectedData.Write(ref pos, (ushort)beheld.Body); expectedData.Write(ref pos, (ushort)beheld.X); expectedData.Write(ref pos, (ushort)beheld.Y); expectedData.Write(ref pos, (byte)beheld.Z); expectedData.Write(ref pos, (byte)beheld.Direction); expectedData.Write(ref pos, (ushort)(isSolidHue ? beheld.SolidHueOverride : beheld.Hue)); expectedData.Write(ref pos, (byte)beheld.GetPacketFlags(sa)); expectedData.Write(ref pos, (byte)Notoriety.Compute(beholder, beheld)); byte layer; for (var i = 0; i < items.Count; i++) { var item = items[i]; layer = (byte)item.Layer; if (!item.Deleted && !layers[layer] && beholder.CanSee(item)) { layers[layer] = true; expectedData.Write(ref pos, item.Serial); var hue = isSolidHue ? beheld.SolidHueOverride : item.Hue; var itemID = item.ItemID & itemIdMask; var writeHue = newPacket || hue != 0; if (!newPacket) { itemID |= 0x8000; } expectedData.Write(ref pos, (ushort)itemID); expectedData.Write(ref pos, layer); if (writeHue) { expectedData.Write(ref pos, (ushort)hue); } } } layer = (byte)Layer.Hair; var itemId = beheld.HairItemID; if (itemId > 0 && !layers[layer]) { expectedData.Write(ref pos, HairInfo.FakeSerial(beheld)); var hue = isSolidHue ? beheld.SolidHueOverride : beheld.HairHue; itemId &= itemIdMask; var writeHue = newPacket || hue != 0; if (!newPacket) { itemId |= 0x8000; } expectedData.Write(ref pos, (ushort)itemId); expectedData.Write(ref pos, layer); if (writeHue) { expectedData.Write(ref pos, (ushort)hue); } } layer = (byte)Layer.FacialHair; itemId = beheld.FacialHairItemID; if (itemId > 0 && !layers[layer]) { expectedData.Write(ref pos, FacialHairInfo.FakeSerial(beheld)); var hue = isSolidHue ? beheld.SolidHueOverride : beheld.FacialHairHue; itemId &= itemIdMask; var writeHue = newPacket || hue != 0; if (!newPacket) { itemId |= 0x8000; } expectedData.Write(ref pos, (ushort)itemId); expectedData.Write(ref pos, layer); if (writeHue) { expectedData.Write(ref pos, (ushort)hue); } } #if NO_LOCAL_INIT expectedData.Write(ref pos, 0); // Zero serial, terminate list #else pos += 4; #endif expectedData.Slice(1, 2).Write((ushort)pos); // Length expectedData = expectedData.Slice(0, pos); AssertThat.Equal(data, expectedData); }
public void Import_Contacts_Template_With_Void_Lines_Between_Contacts() { ContactCreator.ImportTemplateWithVoidLinesBetweenContacts(); AssertThat.IsTrue(ContactCreator.IsContactFileImportedSuccessfully, "Contacts were not imported but they should."); }
public void Import_Contacts_With_Invalid_Combo_Box_Values() { ContactCreator.ImportTemplateContactWithInvalidComboValues(); AssertThat.IsTrue(ContactCreator.IsContactFileFailedToImport, "Contact with invalid combo box values was imported but it should not"); }
public void Import_Contacts_With_All_Contact_Fields_Filled() { ContactCreator.ImportTemplateContactWithAllValues(); AssertThat.IsTrue(ContactCreator.IsContactFileImportedSuccessfully, "Contact was not imported successfully"); AssertThat.IsTrue(ContactCreator.FirstContact.AreContactFieldValuesSavedCorrectly, "Contact field values where not saved correctly"); }
/// <summary> /// Switch to use conneciton /// </summary> /// <param name="name"></param> public static void SwitchChannel(string name) { AssertThat.IsTrue(_connections.ContainsKey(name)); _tcpConnection = _connections[name]; }
public void TestMobileStatusExtended(ProtocolChanges changes) { var beholder = new Mobile(0x1) { Name = "Random Mobile 1" }; beholder.DefaultMobileInit(); var beheld = new Mobile(0x2) { Name = "Random Mobile 2" }; beheld.DefaultMobileInit(); var ns = new NetState(null) { ProtocolChanges = changes }; var data = new MobileStatus(beholder, beheld, ns).Compile(); Span <byte> expectedData = stackalloc byte[121]; // Max Size var pos = 0; expectedData.Write(ref pos, (byte)0x11); pos += 2; // Length int type; var notSelf = beholder != beheld; if (notSelf) { type = 0; } else if (Core.HS && ns.ExtendedStatus) { type = 6; } else if (Core.ML && ns.SupportsExpansion(Expansion.ML)) { type = 5; } else { type = Core.AOS ? 4 : 3; } expectedData.Write(ref pos, beheld.Serial); expectedData.WriteAsciiFixed(ref pos, beheld.Name, 30); expectedData.WriteReverseAttribute(ref pos, beheld.Hits, beheld.HitsMax, notSelf); expectedData.Write(ref pos, beheld.CanBeRenamedBy(beheld)); expectedData.Write(ref pos, (byte)type); if (type > 0) { expectedData.Write(ref pos, beheld.Female); expectedData.Write(ref pos, (ushort)beheld.Str); expectedData.Write(ref pos, (ushort)beheld.Dex); expectedData.Write(ref pos, (ushort)beheld.Int); expectedData.WriteReverseAttribute(ref pos, beheld.Stam, beheld.StamMax, notSelf); expectedData.WriteReverseAttribute(ref pos, beheld.Mana, beheld.ManaMax, notSelf); expectedData.Write(ref pos, beheld.TotalGold); expectedData.Write( ref pos, (ushort)(Core.AOS ? beheld.PhysicalResistance : (int)(beheld.ArmorRating + 0.5)) ); expectedData.Write(ref pos, (ushort)(Mobile.BodyWeight + beheld.TotalWeight)); if (type >= 5) { expectedData.Write(ref pos, (ushort)beheld.MaxWeight); expectedData.Write(ref pos, (byte)(beheld.Race.RaceID + 1)); // 0x00 for a non-ML enabled account } expectedData.Write(ref pos, (ushort)beheld.StatCap); expectedData.Write(ref pos, (byte)beheld.Followers); expectedData.Write(ref pos, (byte)beheld.FollowersMax); if (type >= 4) { expectedData.Write(ref pos, (ushort)beheld.FireResistance); expectedData.Write(ref pos, (ushort)beheld.ColdResistance); expectedData.Write(ref pos, (ushort)beheld.PoisonResistance); expectedData.Write(ref pos, (ushort)beheld.EnergyResistance); expectedData.Write(ref pos, (ushort)beheld.Luck); } var min = 0; var max = 0; beheld.Weapon?.GetStatusDamage(beheld, out min, out max); expectedData.Write(ref pos, (ushort)min); expectedData.Write(ref pos, (ushort)max); expectedData.Write(ref pos, beheld.TithingPoints); if (type >= 6) { for (var i = 0; i < 15; ++i) { expectedData.Write(ref pos, (ushort)beheld.GetAOSStatus(i)); } } } expectedData.Slice(1, 2).Write((ushort)pos); // Length expectedData = expectedData.Slice(0, pos); AssertThat.Equal(data, expectedData); }
public void Import_Contact_Without_Values_In_Mandatory_Field() { ContactCreator.ImportTemplateContactWithoutLastName(); AssertThat.IsTrue(ContactCreator.IsContactFileFailedToImport, "Contact was imported successfully though last name field was left null. Defect spotted!"); }
public void Can_Edit_User_Profile() { LeftSideMenu.GoToProfile(); ProfileEditor.EditAllProfileSettings(); AssertThat.IsTrue(ProfileEditor.AreProfileChangesSavedCorrectly, "Profile changes did not save successfully after edit."); }
public void Import_Contacts_With_Nonexistent_Organization() { ContactCreator.ImportTemplateContactWithInvalidOrganization(); AssertThat.IsTrue(ContactCreator.IsContactFileFailedToImport, "Contact was imported successfully though organization name value contains a non existent organization. Defect spotted!"); }
public void Can_Import_Contact_Template() { ContactCreator.ImportTemplateSimpleContact(); AssertThat.IsTrue(ContactCreator.IsContactFileImportedSuccessfully, "Contact was not imported successfully"); AssertThat.IsTrue(ContactCreator.FirstContact.AreContactFieldValuesSavedCorrectly, "Contact field values where not saved correctly"); }
public void Import_Contacts_With_Nonsense_Values() { ContactCreator.ImportTemplateContactWithNonsenseValues(); AssertThat.IsTrue(ContactCreator.IsContactFileImportedSuccessfully, "Contact was not imported but it should."); AssertThat.IsTrue(ContactCreator.FirstContact.AreContactFieldValuesSavedCorrectly, "Contact field values where not saved correctly"); }
public void Can_Import_Organization_Template() { OrganizationCreator.ImportSimpleOrganization(); AssertThat.IsTrue(OrganizationCreator.IsOrganizationFileImportedSuccessfully, "Organization was not imported successfully"); AssertThat.IsTrue(OrganizationCreator.FirstOrganization.AreOrganizationFieldValuesSavedCorrectly, "Organization field values where not saved correctly"); }
public void Import_Contact_With_Overflow_Field_Values() { ContactCreator.ImportTemplateContactWithOverflowValues(); AssertThat.IsTrue(ContactCreator.IsContactFileFailedToImport, "Contact was imported successfully though first and last name values exceed character limit. Defect spotted!"); }
object GetVariableValue(string type, string value) { if (string.IsNullOrEmpty(value)) { if (type == Common.double_) { return((double)0); } if (type == Common.float_) { return((float)0); } if (type == Common.int32_) { return((int)0); } if (type == Common.int64_) { return((long)0); } if (type == Common.uint32_) { return((uint)0); } if (type == Common.uint64_) { return((ulong)0); } if (type == Common.sint32_) { return((int)0); } if (type == Common.sint64_) { return((long)0); } if (type == Common.fixed32_) { return((uint)0); } if (type == Common.fixed64_) { return((ulong)0); } if (type == Common.sfixed32_) { return((int)0); } if (type == Common.sfixed64_) { return((long)0); } if (type == Common.bool_) { return(false); } if (type == Common.string_) { return(""); } if (type == Common.bytes_) { return(ByteString.Empty); } if (type == Common.double_s) { return(new RepeatedField <double>()); } if (type == Common.float_s) { return(new RepeatedField <float>()); } if (type == Common.int32_s) { return(new RepeatedField <int>()); } if (type == Common.int64_s) { return(new RepeatedField <long>()); } if (type == Common.uint32_s) { return(new RepeatedField <uint>()); } if (type == Common.uint64_s) { return(new RepeatedField <ulong>()); } if (type == Common.sint32_s) { return(new RepeatedField <int>()); } if (type == Common.sint64_s) { return(new RepeatedField <long>()); } if (type == Common.fixed32_s) { return(new RepeatedField <uint>()); } if (type == Common.fixed64_s) { return(new RepeatedField <ulong>()); } if (type == Common.sfixed32_s) { return(new RepeatedField <int>()); } if (type == Common.sfixed64_s) { return(new RepeatedField <long>()); } if (type == Common.bool_s) { return(new RepeatedField <bool>()); } if (type == Common.string_s) { return(new RepeatedField <string>()); } AssertThat.Fail("Type error"); return(null); } if (type == Common.float_) { return(float.Parse(value)); } if (type == Common.int32_) { return(int.Parse(value)); } if (type == Common.int64_) { return(long.Parse(value)); } if (type == Common.uint32_) { return(uint.Parse(value)); } if (type == Common.uint64_) { return(ulong.Parse(value)); } if (type == Common.sint32_) { return(int.Parse(value)); } if (type == Common.sint64_) { return(long.Parse(value)); } if (type == Common.fixed32_) { return(uint.Parse(value)); } if (type == Common.fixed64_) { return(ulong.Parse(value)); } if (type == Common.sfixed32_) { return(int.Parse(value)); } if (type == Common.sfixed64_) { return(long.Parse(value)); } if (type == Common.bool_) { return(value == "1"); } if (type == Common.string_) { return(value.ToString()); } if (type == Common.bytes_) { return(ByteString.CopyFromUtf8(value.ToString())); } if (type == Common.double_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <double> newValue = new RepeatedField <double>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(double.Parse(datas[i])); } return(newValue); } if (type == Common.float_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <float> newValue = new RepeatedField <float>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(float.Parse(datas[i])); } return(newValue); } if (type == Common.int32_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <int> newValue = new RepeatedField <int>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(int.Parse(datas[i])); } return(newValue); } if (type == Common.int64_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <long> newValue = new RepeatedField <long>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(long.Parse(datas[i])); } return(newValue); } if (type == Common.uint32_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <uint> newValue = new RepeatedField <uint>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(uint.Parse(datas[i])); } return(newValue); } if (type == Common.uint64_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <ulong> newValue = new RepeatedField <ulong>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(ulong.Parse(datas[i])); } return(newValue); } if (type == Common.sint32_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <int> newValue = new RepeatedField <int>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(int.Parse(datas[i])); } return(newValue); } if (type == Common.sint64_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <long> newValue = new RepeatedField <long>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(long.Parse(datas[i])); } return(newValue); } if (type == Common.fixed32_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <uint> newValue = new RepeatedField <uint>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(uint.Parse(datas[i])); } return(newValue); } if (type == Common.fixed64_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <ulong> newValue = new RepeatedField <ulong>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(ulong.Parse(datas[i])); } return(newValue); } if (type == Common.sfixed32_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <int> newValue = new RepeatedField <int>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(int.Parse(datas[i])); } return(newValue); } if (type == Common.sfixed64_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <long> newValue = new RepeatedField <long>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(long.Parse(datas[i])); } return(newValue); } if (type == Common.bool_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <bool> newValue = new RepeatedField <bool>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(datas[i] == "1"); } return(newValue); } if (type == Common.string_s) { string data = value.Trim('"'); string[] datas = data.Split('|'); RepeatedField <string> newValue = new RepeatedField <string>(); for (int i = 0; i < datas.Length; i++) { newValue.Add(datas[i]); } return(newValue); } AssertThat.Fail("Type error"); return(null); }
public void Import_Contacts_Template_Containing_More_Columns_Than_Normal() { ContactCreator.ImportTemplateWithMoreColumns(); AssertThat.IsTrue(ContactCreator.IsContactFileImportedSuccessfully, "Contact was not imported but it should."); AssertThat.IsTrue(ContactCreator.FirstContact.AreContactFieldValuesSavedCorrectly, "Contact field values where not saved correctly"); }
public void AddPlugin(IPlugin plugin) { AssertThat.IsNotNull(plugin); plugins.Add(plugin.Name, plugin); }
/// <summary> /// Add new conneciton /// </summary> /// <param name="name"></param> /// <param name="tcpConnection"></param> public static void AddConnection(string name, ITcpConnection tcpConnection) { AssertThat.IsFalse(_connections.ContainsKey(name)); _connections.Add(name, tcpConnection); }
public void RemovePlugin(string name) { AssertThat.IsNotNullOrEmpty(name); plugins.Remove(name); }
/// <summary> /// Remove a conneciton /// </summary> /// <param name="name"></param> public static void RemoveConnection(string name) { AssertThat.IsTrue(_connections.ContainsKey(name)); _connections.Remove(name); }