public void CreateUpdateDelete_Pass() { string documentNumber = $"test{Guid.NewGuid().ToString().Substring( 12 )}"; string documentNumber2 = $"{documentNumber}2"; var date = new DateTime(2019, 05, 11); //Create var dtoToInsert = new JournalEntryDto(m_tenantId, date, 0, "USD", documentNumber, $"{documentNumber} notes."); int num = m_sut.InsertJournalEntry(dtoToInsert); Assert.True(num > 0, "failed on InsertJournalEntry"); //Get JournalEntryDto journalEntry = m_sut.GetJournalEntry(m_tenantId, num); Assert.NotNull(journalEntry); Assert.Equal(m_tenantId, journalEntry.Tenant); Assert.Equal(date, journalEntry.Date); Assert.Equal("USD", journalEntry.Currency); Assert.Equal(documentNumber, journalEntry.DocumentNumber); Assert.Equal($"{documentNumber} notes.", journalEntry.PrivateNote); try { //Update var dtoToUpdate = new JournalEntryDto(m_tenantId, date, num, "EUR", documentNumber2, $"{documentNumber2} notes."); m_sut.UpdateJournalEntry(dtoToUpdate); JournalEntryDto updatedJournalEntry = m_sut.GetJournalEntry(m_tenantId, num); Assert.NotNull(updatedJournalEntry); Assert.Equal(m_tenantId, updatedJournalEntry.Tenant); Assert.Equal(date, updatedJournalEntry.Date); Assert.Equal("EUR", updatedJournalEntry.Currency); Assert.Equal(documentNumber2, updatedJournalEntry.DocumentNumber); Assert.Equal($"{documentNumber2} notes.", updatedJournalEntry.PrivateNote); } finally { //Cleanup m_sut.DeleteJournalEntry(m_tenantId, num); journalEntry = m_sut.GetJournalEntry(m_tenantId, num); Assert.Null(journalEntry); } }
public void Dispose() { m_journalEntryProvider.DeleteJournalEntry(m_tenantId, m_journalNum); m_tenantProvider.DeleteTenant(m_tenantId); }