public void TestBadMethod() { var o = new BadData { S = "zzz" }; var data = serializer.Serialize(o); Assert.Throws <InvalidOperationException>(() => serializer.Deserialize <BadData>(data)); }
public ImportLog ToImportLog() { ImportLog log = new ImportLog(); log.Area = nameof(this.ImportArea); log.Success = this.Success; log.DataErrors = (this.BadData.Count > 0); log.ExecutionTime = this.ExecutionTime; log.ImportEnded = this.ProcessStarted; log.ImportStarted = this.ProcessStarted; log.RecordsImported = this.RecordsImported; if (BadData.Count > 0) { IList <string> data = BadData.Select(x => x.Item1).ToList <string>(); log.BadData = string.Join(Environment.NewLine, data); } return(log); }
/// <summary> /// Adds a BadData enum value to a list of codes /// </summary> /// <param name="list">List to add the enum value to</param> /// <param name="code">The BadData enum value to add to the list</param> private void AddBadDataCode(List <BadData> list, BadData code) { list.Add(code); }