コード例 #1
0
        public void TestBadMethod()
        {
            var o = new BadData {
                S = "zzz"
            };
            var data = serializer.Serialize(o);

            Assert.Throws <InvalidOperationException>(() => serializer.Deserialize <BadData>(data));
        }
コード例 #2
0
ファイル: ImportResult.cs プロジェクト: MrBurley/FACDataAPI
        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);
        }
コード例 #3
0
 /// <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);
 }