Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a summary objects, who's responsibilities actually to combine a lot of things together and create a summary report.
In this objects I have a lot of structures like this:

C#
public class SummaryVisit : Visit, IMappable
{
    public int SummaryId { get; set; }

    public int PatientId { get; set; }

    public int LocationId { get; set; }

    public IMappable Patient
    {
        get
        {
            return new SummaryPatient(PatientBusinessService.FindPatient(this.PatientId));
        }
    }

    public IMappable Location
    {
        get
        {
            return new SummaryLocation(LocationBusinessService.FindLocation(this.LocationId));
        }
    }

    public IEnumerable<IMappable> Comments
    {
        get
        {
            return new SummaryComments(CommentBusinessService.FindComments(this.SummaryId));
        }
    }

    // ... can be a lot of these structures
    // ... using different business services and summary objects

    public IEnumerable<IMappable> Tasks
    {
        get
        {
            return new SummaryTasks(TaskBusinessService.FindTasks(this));
        }
    }
}


PatientBusinessService, LocationBusinessService etc. are statics.
And each of these SummaryPatient, SummaryLocation etc. have the same type of structure inside.

What is the best approach to refactor and test this?
Tried to replace static calls with calls via the interfaced proxies, but this class just got a lot of these interfaces as the constructor injection stuff and start to be super greedy.
Posted
Updated 18-Jul-14 12:33pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900