public async Task InsertReadRecord_SingleEntity() { var ah = new Mock <IAuditManager>(); var read = new TestClass { Id = "b" }; var wc = new WorkContext(); await AuditManagerExtensions.InsertReadRecord(ah.Object, read, wc); ah.Verify(a => a.InsertAuditRecord( It.Is <Type>(x => x == typeof(TestClass)), It.Is <string>(i => i == read.Id), It.Is <string>(i => i == AuditRecordTypes.READ), It.Is <WorkContext>(w => w == wc), It.Is <object>(x => x == read)), Times.Once); }
public async Task InsertReadRecord_Pagination() { var ah = new Mock <IAuditManager>(); var page = new Pagination <TestClass> { Total = 123, Data = new[] { new TestClass { Id = "b" } } }; var wc = new WorkContext(); await AuditManagerExtensions.InsertReadRecord(ah.Object, page, wc); ah.Verify(a => a.InsertAuditRecord( It.Is <Type>(x => x == typeof(TestClass)), It.Is <string>(i => i == null), It.Is <string>(i => i == AuditRecordTypes.READ), It.Is <WorkContext>(w => w == wc), It.Is <object>(x => x.GetPropertyValueByName <int>("total") == page.Total)), Times.Once); }