static void Main(string[] args)
    {
        //Hp --> Logic: Create factory instance by passing concrete class type.
        var factory = ReminderFactory.Create <InvoiceSummary>();
        var x       = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
    static void Main(string[] args)
    {
        var factory = ReminderFactory <InvoiceSummary> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName};{item.TotalAmount}"));
        Console.ReadKey();
    }
    static void Main(string[] args)
    {
        //Hp --> While creating factory instance, must pass concreate class type of T.
        var factory = ReminderFactory <InvoiceSummary> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
Example #4
0
    static void Main(string[] args)
    {
        //Hp --> Note: While creating factory instance, must pass concreate class type of T.
        //var factory = ReminderFactory<InvoiceSummary>.GetReminder("Invoicing");
        //Hp --> Logic: Simplified version of creating factory instance by removing hard coded string (as shown in above line)
        var factory = ReminderFactory.GetReminder <InvoiceSummary>();
        var x       = factory.GetRemindersToBeSent(new InvoiceRepository());

        x.ToList().ForEach(item =>
                           Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
        public void Json_TrySerializeModel_Succeed()
        {
            var now   = DateTime.Now;
            var model = ReminderFactory.Create(now);
            var ser   = new JsonSerializationService();

            string serializerResult;
            var    result = ser.TrySerialize(model, out serializerResult);

            Assert.IsTrue(result);
            Assert.IsNotNull(serializerResult);
        }
    static void Main(string[] args)
    {
        //Hp --> Note: While creating factory instance we are passing interface type.
        var factory = ReminderFactory <IIdentifiableEntity> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());

        //Hp --> Note: While reading data we need to cast to corrsponding concreate class type.
        x.Cast <InvoiceSummary>().ToList().ForEach(item =>
                                                   Console.WriteLine($"{item.EntityName}:{item.TotalAmount}"));
        Console.ReadKey();
    }
        public void Json_SerializeModel_Succeed()
        {
            var now   = DateTime.Now;
            var model = ReminderFactory.Create(now);

            Assert.AreEqual(now, model.NextDue);

            var ser = new JsonSerializationService();

            var result = ser.Serialize(model);

            Assert.IsNotNull(result);
        }
    static void Main(string[] args)
    {
        var factory = ReminderFactory <IIdentifiableEntity> .GetReminder("Invoicing");

        var x = factory.GetRemindersToBeSent(new InvoiceRepository());
    }