Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Configure();

            var service = new LicenseService();
            var license = service.CreateLicense("Ivan");

            service.ShowLicenseInfo(license);
        }
Exemplo n.º 2
0
        public void CreateLicenseTest()
        {
            var expectedName = "John";
            var expectedCode = CodeGeneratorMock.GeneratedCode;

            Dependency.RegisterType <ICodeGenerator, CodeGeneratorMock>();

            var licenseService = new LicenseService();
            var license        = licenseService.CreateLicense(expectedName);

            Assert.AreEqual(expectedName, license.OwnerName);
            Assert.AreEqual(expectedCode, license.Code);
        }
Exemplo n.º 3
0
 public string CreateLicense(LicenseFeaturesParams p)
 {
     try
     {
         return(LicenseService.CreateLicense(p).ToString());
     }
     catch (DuplicateKeyException)
     {
         return(string.Format("Error, cannot insert duplicate License Key: {0}", p.LicenseKey));
     }
     catch (Exception ex)
     {
         return(string.Format("Error: {0}", ex.Message));
     }
 }