Пример #1
0
        static void Main(string[] args)
        {
            {
                // Without ninJect
                Address add = new Address() { Postcode = "PR2 2UT" };
                Applicant applicant = new Applicant(add);
                applicant.EmailAddress = "*****@*****.**";
                Application app = new Application(applicant);
                app.emailManager = new EmailManager();
                app.emailManager.message = "Setup using basic DI pattern";

                Console.WriteLine(app.sendEmail());
                Console.WriteLine(JsonConvert.SerializeObject(app));

                Console.ReadKey();
            }

            using (var kernel = new MoqMockingKernel())
            {
                SetupNinJect(kernel);

                // With NinJect (includes Mocking as well!
                var app = kernel.Get<IApplication>();

                Console.WriteLine(app.sendEmail());
                Console.WriteLine(JsonConvert.SerializeObject(app.App1));
                Console.ReadKey();
            }
        }
Пример #2
0
 public Applicant(Address address)
 {
     this.Address = address;
 }