Exemple #1
0
 //Constructor
 public CalculationSelection(int price, CountryTaxInformation country)
 {
     Price        = price;
     Country      = new CountryTaxInformation();
     Country.Name = country.Name;
     Country.Tax  = country.Tax;
 }
        public List <float> DoCalculations(int price, string countryName, int countryTax)
        {
            //Loading the assembly
            var dllFile = new FileInfo(@"C:\Users\Katarina\Documents\Visual Studio 2015\Projects\TestProject.Web\TestProject.MEF\Extensions\TestProject.MEF.dll");
            var asm     = Assembly.LoadFrom(dllFile.FullName);
            //Create the catalog
            var catalog = new AssemblyCatalog(asm);
            //Create the composition container
            CompositionContainer container = new CompositionContainer(catalog);

            //Create an instance of CalculationSelection class
            CountryTaxInformation country = new CountryTaxInformation();

            country.Name = countryName;
            country.Tax  = countryTax;

            CalculationSelection myCalculations = new CalculationSelection(price, country);

            //Perform all the tax calculations
            List <float> returnVariables = new List <float>();

            returnVariables = PeformCalculations(container, myCalculations);
            return(returnVariables);
        }