Exemplo n.º 1
0
        private static void AdapterDemo()
        {
            ITarget target = new VendorAdapter();

            foreach (var product in target.GetProducts())
            {
                Console.WriteLine(product);
            }
        }
Exemplo n.º 2
0
        public void TestMethod1()
        {
            ITarget adapter = new VendorAdapter();

            var products = adapter.GetProducts();

            //4 items
            Assert.IsNotNull(products);
        }
Exemplo n.º 3
0
        public void Test1()
        {
            ITarget adapter  = new VendorAdapter();
            var     actual   = adapter.GetProducts();
            var     expected = new List <string>();

            expected.AddRange(new[] { "Gaming Consoles", "Television", "Books", "Musical Instruments" });
            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
    static void Main(string[] args)
    {
        ITarget adapter = new  VendorAdapter();

        foreach (string product in adapter.GetProducts())
        {
            Console.WriteLine(product);
        }
        Console.ReadLine();
    }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            // Example 1

            example_1.ITarget adapter = new VendorAdapter();

            foreach (string product in adapter.GetProducts())
            {
                Console.WriteLine(product);
            }


            // Example 2

            example_2.ITarget adapter2 = new EmployeeAdapter();

            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(adapter2);

            client.ShowEmployeeList();

            // Example 3

            // Non-adapted chemical compound
            Compound unknown = new Compound("Unknown");

            unknown.Display();

            // Adapted chemical compounds
            Compound water = new RichCompound("Water");

            water.Display();

            Compound benzene = new RichCompound("Benzene");

            benzene.Display();

            Compound ethanol = new RichCompound("Ethanol");

            ethanol.Display();

            // Example 4

            ILumiaXMLTarget lumiaXmladapter = new LumiaXMLAdapter();
            XmlDocument     lumiaXmlData    = lumiaXmladapter.GetLumiaMobilesXMLSpecifications();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.activity_main_grid);

            Intent intent = Intent;

            Title = intent.GetStringExtra("Name");


            app = FirebaseApp.Instance;
            db  = FirebaseFirestore.GetInstance(app);

            string category = intent.GetStringExtra("category");

            //Setup Views
            swipeRefreshLayout          = (SwipeRefreshLayout)FindViewById(Resource.Id.refreshView);
            swipeRefreshLayout.Refresh += delegate(object sender, System.EventArgs e)
            {
                reload = true;
                FetchCollection(category);
            };

            swipeRefreshLayout.Post(() => {
                swipeRefreshLayout.Refreshing = true;
                recyclerView.Clickable        = false;
            });

            reload  = true;
            vendors = new List <Vendor>();
            FetchCollection(category);
            vendorAdapter            = new VendorAdapter(vendors);
            vendorAdapter.ItemClick += OnItemClick;

            recyclerView = FindViewById <RecyclerView>(Resource.Id.activity_mgrid_rv);
            recyclerView.SetLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.Vertical));
            recyclerView.SetAdapter(vendorAdapter);
        }