Example #1
0
        public void ProperlyConvertCustomerDocumentToCustomerEntity()
        {
            var customerDocument = new CustomerDocument
            {
                Number        = "1234",
                CspId         = "4d76dc22-7649-4f84-bc6c-e1bf6921e31c",
                LicensingMode = "Automatic"
            };

            var customer = customerDocument.AsCustomer();

            customer.Number.Should().Be(new CustomerNumber("1234"));
            customer.CspId.Should().Be(new CustomerCspId("4d76dc22-7649-4f84-bc6c-e1bf6921e31c"));
            customer.LicensingMode.Should().Be(Automatic);
        }
Example #2
0
 public static Customer AsCustomer(this CustomerDocument customerDocument) =>
 new Customer(
     new CustomerNumber(customerDocument.Number),
     new CustomerCspId(customerDocument.CspId),
     (CustomerLicensingMode)Enum.Parse(typeof(CustomerLicensingMode), customerDocument.LicensingMode, true));