public void Interactions_can_be_persisted_and_retrieved() { //Arrange var sutProvider = new DataProvider <Interaction>(_config, Interaction.ToDomainConverter); var columns = sutProvider.LoadAllColumns(); var sutPersister = new InteractionPersister(columns, _config); var interactionRecord = TestData.Interactions.TakeSelfieWithPet; //Act ErrorMessage error; var persistResult = sutPersister.TryPersist(ref interactionRecord, out error); //Assert Assert.IsTrue(persistResult); Assert.IsNull(error); //The new row id is assigned to ref of the object Assert.IsNotNull(interactionRecord.InteractionId); Assert.IsInstanceOf <int>(interactionRecord.InteractionId); var readResult = sutProvider.LoadAll().First(); Assert.AreEqual(interactionRecord, readResult); }
private bool PersistInteraction(out ErrorMessage error, ref Interaction persistedInteraction) { var provider = new DataProvider <Interaction>(_config, Interaction.ToDomainConverter); var columns = provider.LoadAllColumns(); var persister = new InteractionPersister(columns, _config); return(persister.TryPersist(ref persistedInteraction, out error)); }