internal static void AssertEqual(this SampleOrder expected, ISampleOrderDetailReturn result) { Assert.AreEqual(expected.ToSampleOrderKey().KeyValue, result.SampleRequestKey); Assert.AreEqual(expected.DateDue, result.DateDue); Assert.AreEqual(expected.DateReceived, result.DateReceived); Assert.AreEqual(expected.DateCompleted, result.DateCompleted); Assert.AreEqual(expected.Status, result.Status); Assert.AreEqual(expected.Active, result.Active); Assert.AreEqual(expected.FOB, result.FOB); Assert.AreEqual(expected.ShipmentMethod, result.ShipVia); Assert.AreEqual(expected.Comments, result.Comments); Assert.AreEqual(expected.PrintNotes, result.NotesToPrint); var requestCompany = expected.RequestCustomer == null ? null : expected.RequestCustomer.Company; requestCompany.AssertEqual(result.RequestedByCompany); expected.Request.AssertEqual(result.RequestedByShippingLabel); Assert.AreEqual(expected.ShipToCompany, result.ShipToCompany); expected.ShipTo.AssertEqual(result.ShipToShippingLabel); expected.Broker.AssertEqual(result.Broker); expected.Employee.AssertEqual(result.CreatedByUser); expected.Items.AssertEquivalent(result.Items, e => e.ToSampleOrderItemKey().KeyValue, r => r.ItemKey, (e, r) => e.AssertEqual(r)); expected.JournalEntries.AssertEquivalent(result.JournalEntries, j => j.ToSampleOrderJournalEntryKey().KeyValue, r => r.JournalEntryKey, (e, r) => e.AssertEqual(r)); }
internal static void AssertEqual(this ISetSampleOrderParameters expected, SampleOrder result) { if (!string.IsNullOrWhiteSpace(expected.SampleOrderKey)) { Assert.AreEqual(expected.SampleOrderKey, result.ToSampleOrderKey().KeyValue); } Assert.AreEqual(expected.DateDue, result.DateDue); Assert.AreEqual(expected.DateReceived, result.DateReceived); Assert.AreEqual(expected.DateCompleted, result.DateCompleted); Assert.AreEqual(expected.Status, result.Status); Assert.AreEqual(expected.Active, result.Active); Assert.AreEqual(expected.Comments, result.Comments); Assert.AreEqual(expected.PrintNotes, result.PrintNotes); Assert.AreEqual(expected.Volume, result.Volume); Assert.AreEqual(expected.ShipToCompany, result.ShipToCompany); Assert.AreEqual(expected.ShipmentMethod, result.ShipmentMethod); Assert.AreEqual(expected.FOB, result.FOB); if (!string.IsNullOrWhiteSpace(expected.BrokerKey)) { Assert.AreEqual(expected.BrokerKey, result.Broker.ToCompanyKey().KeyValue); } else { Assert.IsNull(result.Broker); } if (!string.IsNullOrWhiteSpace(expected.RequestedByCompanyKey)) { Assert.AreEqual(expected.RequestedByCompanyKey, result.RequestCustomer.ToCustomerKey().KeyValue); } else { Assert.IsNull(result.RequestCustomer); } expected.RequestedByShippingLabel.AssertEquivalent(result.Request); expected.ShipToShippingLabel.AssertEquivalent(result.ShipTo); Assert.AreEqual(expected.Items.Count(), result.Items.Count); foreach (var item in expected.Items) { Assert.IsTrue(result.Items.Any(i => { try { item.AssertEqual(i); return(true); } catch { return(false); } })); } }
internal static void AssertEqual(this SampleOrder expected, ISampleOrderSummaryReturn result) { Assert.AreEqual(expected.ToSampleOrderKey().KeyValue, result.SampleRequestKey); Assert.AreEqual(expected.DateDue, result.DateDue); Assert.AreEqual(expected.DateReceived, result.DateReceived); Assert.AreEqual(expected.DateCompleted, result.DateCompleted); Assert.AreEqual(expected.Status, result.Status); var requestCompany = expected.RequestCustomer == null ? null : expected.RequestCustomer.Company; requestCompany.AssertEqual(result.RequestedByCompany); expected.Broker.AssertEqual(result.Broker); expected.Employee.AssertEqual(result.CreatedByUser); }