|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using System.Threading.Tasks; |
| 6 | + |
| 7 | +namespace Coverlet.Core.CoverageSamples.Tests |
| 8 | +{ |
| 9 | + public record RecordWithPropertyInit |
| 10 | + { |
| 11 | + private int _myRecordVal = 0; |
| 12 | + public RecordWithPropertyInit() |
| 13 | + { |
| 14 | + _myRecordVal = new Random().Next(); |
| 15 | + } |
| 16 | + public string RecordAutoPropsNonInit { get; set; } |
| 17 | + public string RecordAutoPropsInit { get; set; } = string.Empty; |
| 18 | + } |
| 19 | + |
| 20 | + public class ClassWithRecordsAutoProperties |
| 21 | + { |
| 22 | + record RecordWithPrimaryConstructor(string Prop1, string Prop2); |
| 23 | + |
| 24 | + public ClassWithRecordsAutoProperties() |
| 25 | + { |
| 26 | + var record = new RecordWithPrimaryConstructor(string.Empty, string.Empty); |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + public class ClassWithInheritingRecordsAndAutoProperties |
| 31 | + { |
| 32 | + record BaseRecord(int A); |
| 33 | + |
| 34 | + record InheritedRecord(int A) : BaseRecord(A); |
| 35 | + |
| 36 | + public ClassWithInheritingRecordsAndAutoProperties() |
| 37 | + { |
| 38 | + var record = new InheritedRecord(1); |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + public class ClassWithRecordsEmptyPrimaryConstructor |
| 43 | + { |
| 44 | + internal record First |
| 45 | + { |
| 46 | + public string Bar() => "baz"; |
| 47 | + } |
| 48 | + |
| 49 | + internal record Second() |
| 50 | + { |
| 51 | + public string Bar() => "baz"; |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + public class ClassWithAbstractRecords |
| 56 | + { |
| 57 | + public abstract record AuditData() |
| 58 | + { |
| 59 | + public abstract string GetAuditType(); |
| 60 | + } |
| 61 | + |
| 62 | + public abstract record AuditData |
| 63 | + { |
| 64 | + private protected AuditData() |
| 65 | + { |
| 66 | + |
| 67 | + } |
| 68 | + |
| 69 | + public abstract string GetAuditType(); |
| 70 | + } |
| 71 | + } |
| 72 | +} |
0 commit comments