How to convert one object to onother object

Apr 19 2013 4:48 AM
HI Eveyboyd,

I have this:

2 classes:

Trial License

[code]
public partial class TrialLicense {
  }
[/code]

and:

RealLicense:

[code]
public partial class RealLicense {
     
  }
[/code]

And a testUnit:

[code]

  [Test]
        public void WhenTrialLicenseGoesToRealLicenseThenRealLicenseShouldBeActive()
        {

            var target = new License(Ecospace);
            var targetTrialLicense = new TrialLicense(Ecospace);
            var targetRealLicense = new RealLicense(Ecospace);
            targetTrialLicense.StartDate = DateTime.Today.AddDays(1);
            targetTrialLicense.ExpireDate = DateTime.Today.AddDays(30);
            targetRealLicense.ExpireDate = DateTime.Today.AddDays(31);     
         Assert.IsTrue( Convert.ChangeType(System.Convert(targetTrialLicense), System.Convert(targetRealLicense)));
           

        }
[/code]

Now the scenario goes: after a period of time the TrialLicense goes to the RealLicense. I try to convert the object TrialLicense to the object: RealLicense.

THX.

Answers (1)