I am playing with sequence diagram. And main question is how to draw properly on sequence diagram interaction with variable. How to draw
1) When MakePayment
aggregates person
insurance.MakePayment(person.FirstName, person.SecondName, 20);
2) Variable assignment
internalVariable = SecondName;
I am not sure that I draw right sequence.
namespace Example
{
public class Person
{
public string FirstName { get; set; }
public string SecondName { get; set; }
public string Salary { get; set; }
}
public class Insurance
{
private readonly Bank bank;
public Insurance()
{
bank = new Bank();
}
public bool MakePayment(string FirstName, string SecondName, int value)
{
if (bank.GetBalance(FirstName, SecondName) > value)
{
}
return true;
}
}
public class Bank
{
private string SomeVariable { get; set; }
private string internalVariable;
public Bank()
{
}
public decimal GetBalance(string FirstName, string SecondName)
{
SomeVariable = FirstName;
internalVariable = SecondName;
return 320;
}
}
class Program
{
static void Main(string[] args)
{
Person person = new Person();
person.FirstName = "FirstName";
person.SecondName = "SecondName";
Insurance insurance = new Insurance();
insurance.MakePayment(person.FirstName, person.SecondName, 20);
PrintResult(person.FirstName);
}
public static void PrintResult(string firstName)
{
Console.WriteLine(firstName);
}
}
}