
474 N.W.2d 438 (1991)
MILWAUKEE MUTUAL INSURANCE COMPANY, Respondent,
v.
David J. MURPHY, Appellant.
No. C2-91-433.
Court of Appeals of Minnesota.
September 3, 1991.
Willard L. Converse, Peterson, Bell, Converse & Jensen, St. Paul, for respondent.
James A. Heuer, Jr., Mark C. Vandelist, Heuer & Vandelist, P.A., Minneapolis, for appellant.
Considered and decided by PARKER, P.J., and AMUNDSON and MULALLY[*], JJ.

OPINION
AMUNDSON, Judge.
Respondent Milwaukee Mutual Insurance Company commenced this declaratory judgment action in September 1990, seeking *439 a determination that it was not obligated to pay no-fault benefits to appellant David Murphy because Murphy failed to attend two scheduled independent medical examinations (IME). Milwaukee Mutual also sought damages of $685 in missed appointment fees. Milwaukee Mutual moved for summary judgment, which was granted. The trial court determined that Milwaukee Mutual was entitled to the missed appointment fees and was not obligated to pay further no-fault benefits until Murphy submitted to an IME. Murphy appeals. We reverse and remand.

FACTS
Murphy was injured in an automobile accident in January 1989. At the time of the accident, Murphy was insured under a policy issued by Milwaukee Mutual. As required by the policy and the No-Fault Act, Milwaukee Mutual paid Murphy's medical expenses. Murphy claims Milwaukee Mutual did not pay all of his medical expenses within the time allowed by statute.
On September 19, 1989, Milwaukee Mutual informed Murphy that it was exercising its right to demand an IME OF Murphy. The IME was scheduled for Thursday, October 26, 1989. On October 20, 1989, Murphy wrote to Milwaukee Mutual, stating he would not attend the scheduled IME. Murphy refused to attend the IME because he claimed Milwaukee Mutual had not paid over $800 in prior medical expenses, some of which Milwaukee Mutual had held for over 30 days. Murphy did not attend the IME, and Milwaukee Mutual was charged $325 for the missed appointment.
Milwaukee Mutual then wrote to Murphy's counsel, requesting both reimbursement for the missed appointment fee and the reason for Murphy's failure to attend the IME. The letter also stated:
After receipt of that information our company will make a decision as to what our position will be in regard to no-fault benefits for David Murphy.
Murphy reiterated his position: he would be willing to attend an IME if Milwaukee Mutual paid all outstanding medical expenses.
In June of 1990, Milwaukee Mutual again wrote to Murphy's counsel, advising him another IME was scheduled for July 13, 1990. Counsel apparently failed to inform Murphy of the IME, and Murphy did not attend. Milwaukee Mutual again contacted Murphy's counsel, requesting payment of $360 for the missed appointment fee. Milwaukee Mutual also stated it would not pay any further medical expenses. If Murphy attended an IME, Milwaukee Mutual stated, it would give further consideration to payment of his medical expenses.
Milwaukee Mutual commenced the present declaratory judgment action in October of 1990. Milwaukee Mutual sought a determination that it was not required to pay further medical expenses payments because Murphy did not attend the scheduled IMEs. In addition, Milwaukee Mutual sought payment of the $685 in missed appointment fees.
Milwaukee Mutual moved for summary judgment on November 21, 1990. On December 10, 1990, Murphy's counsel informed Milwaukee Mutual that Murphy was willing to attend an IME even if Milwaukee Mutual did not pay Murphy's outstanding medical expenses. Counsel also stated his belief that Murphy's willingness to attend an IME made the entire declaratory judgment action moot and asked whether Milwaukee Mutual would schedule the IME. In response, Milwaukee Mutual asked whether Murphy was willing to pay the $685 in missed appointment fees. Murphy took the position that there was no authority for requiring him to pay the missed appointment fees, and Milwaukee Mutual proceeded with its motion for summary judgment. The trial court held Milwaukee Mutual would not be obligated to pay any further basic economic loss benefits until Murphy submitted to an IME, and that Murphy was obligated to pay the missed appointment fees.

ISSUES
1. Did the trial court err in determining that Milwaukee Mutual was not obligated *440 to provide further medical expense payments until Murphy attended an independent medical examination?
2. Did the trial court err in requiring Murphy to pay the missed appointment fees?

ANALYSIS
In reviewing the trial court's grant of summary judgment, this court must determine whether there are any genuine issues of material fact and whether the trial court correctly applied the law. Offerdahl v. University of Minn. Hosps. & Clinics, 426 N.W.2d 425, 427 (Minn.1988). The evidence must be viewed in the light most favorable to the nonmoving party. Carney v. Central Life Assur. Co., 366 N.W.2d 351, 353 (Minn.App.1985).

I.
Minn.Stat. § 65B.56, subd. 1 (1990) provides:
Medical examinations and discovery of condition of claimant. Any person with respect to whose injury benefits are claimed under a plan of reparation security shall, upon request of the reparation obligor from whom recovery is sought, submit to a physical examination by a physician or physicians selected by the obligor as may reasonably be required.
Id. An insurer's obligation to respond to claims is defined by Minn.Stat. § 65B.54 (1990), which provides:
Basic economic loss benefits are payable monthly as loss accrues. Loss accrues not when injury occurs, but as income loss, replacement services loss, survivor's economic loss, survivor's replacement services loss, or medical or funeral expense is incurred. Benefits are overdue if not paid within 30 days after the reparation obligor receives reasonable proof of the fact and amount of loss realized.

Id., subd. 1 (emphasis added).
It is well established that an insurance policy is a contract; the function of a court is to determine what the parties' agreement was and to enforce it. Fillmore v. Iowa Nat'l Mut. Ins. Co., 344 N.W.2d 875, 877 (Minn.App.1984). In construing an insurance contract, the policy must be considered as a whole. Henning Nelson Constr. Co. v. Fireman's Fund Am. Life Ins. Co., 383 N.W.2d 645, 652 (Minn.1986).
The Milwaukee Mutual policy is subject to the statutory requirements of the Minnesota No-Fault Act. See Bobich v. Oja, 258 Minn. 287, 294, 104 N.W.2d 19, 24 (1960). The No-Fault Act requires insurers to pay basic economic loss benefits within 30 days after receipt of reasonable proof of loss. Minn.Stat. § 65B.54, subd. 1. If Milwaukee Mutual breached the insurance contract by failing to pay medical expenses as they came due, Milwaukee Mutual cannot raise Murphy's failure to attend an IME as a basis for terminating payment of benefits. See MTS Co. v. Taiga Corp., 365 N.W.2d 321, 327 (Minn.App.1985), pet. for rev. denied (Minn. June 14, 1985).
We believe the trial court erred in granting summary judgment. Whether Milwaukee Mutual breached the insurance contract by failing to pay Murphy's medical expenses when due is a fact issue which precludes summary judgment. If Milwaukee Mutual breached the contract, Murphy was under no obligation to continue to fulfill his duties under the contract.

II.
Whether Murphy will be required to pay the missed appointment fees charged to Milwaukee Mutual depends on resolution of the breach of contract issue. If Milwaukee Mutual did not breach the insurance contract, then Murphy may be held responsible for damages, including the missed appointment fees, resulting from his breach. See Olson v. Rugloski, 277 N.W.2d 385 (Minn.1979). On the other hand, if Murphy's failure to attend the scheduled IMEs was justified by Milwaukee Mutual's breach of contract, Murphy clearly cannot be required to pay the missed appointment fees.

DECISION
Genuine issues of material fact exist which preclude summary judgment. We *441 reverse the trial court's grant of summary judgment and remand for further proceedings.
Reversed and remanded.
NOTES
[*]  Retired judge of the district court, acting as judge of the Court of Appeals by appointment pursuant to Minn. Const. art. VI, § 2.
