Lung tumors move during breathing depending on the patient's patho-physiological condition and orientation, thereby compromising the accurate deposition of the radiation dose during radiotherapy. In this paper, we present and validate a computer-based simulation framework to calculate the delivered dose to a 3D moving tumor and its surrounding normal tissues. The computer-based simulation framework models a 3D volumetric lung tumor and its surrounding tissues, simulates the tumor motion during a simulated dose delivery both as a self-reproducible motion and a random motion using the dose extracted from a treatment plan, and predicts the amount and location of radiation doses deposited. A radiation treatment plan of a small lung tumor (1-3 cm diameter) was developed in a commercial planning system (iPlan software, BrainLab, Munich, Germany) to simulate the radiation dose delivered. The dose for each radiation field was extracted from the software. The tumor motion was simulated for varying values of its rate, amplitude and direction within a single breath as well as from one breath to another. Such variations represent the variations in tumor motion induced by breathing variations. During the simulation of dose delivery, the dose on the target was summed to generate the real-time dose to the tumor for each beam independently. The simulation results show that the dose accumulated on the tumor varies significantly with both the tumor size and the tumor's motion rate, amplitude and direction. For a given tumor motion rate, amplitude and direction, the smaller the tumor size the smaller is the percentage of the radiation dose accumulated. The simulation results are validated by comparing the center plane of the 3D tumor with 2D film dosimetry measurements using a programmable 4D motion phantom moving in a self-reproducible pattern. The results also show the real-time capability of the framework at 40 discrete tumor motion steps per breath, which is higher than the number of four-dimensional computed tomography (CT) steps (approximately 20) during a single breath. The real-time capability enables the framework to be coupled with real-time tumor monitoring systems such as implanted fiducials for computing the dose delivered in real time during the treatment.