예제 #1
0
        public void SetupTests()
        {
            SettingsService = new SettingsService();

            DependencyConfig config     = new DependencyConfig();
            Parameters       parameters = new Parameters();

            config.Define(typeof(IUserPreferences), typeof(AndroidUserPreferences));
            config.Define(typeof(ISettingsService), typeof(SettingsService));
            DependencyContainer container = new DependencyContainer(config);

            container.ResolveDependencies(SettingsService, parameters);
        }
예제 #2
0
        public void SetupTests()
        {
            SettingsService = new SettingsService();

            DependencyConfig config     = new DependencyConfig();
            Parameters       parameters = new Parameters();

            config.Define(typeof(IUserPreferences), typeof(UserPreferences));
            config.Define(typeof(ISettingsService), typeof(SettingsService));
            DependencyContainer container = new DependencyContainer(config);

            container.ResolveDependencies(SettingsService, parameters);

            OperationProcessor op = OperationProcessor.Instance;

            op.DepedencyContainer = container;
        }
예제 #3
0
        public void SetupService()
        {
            DependencyConfig config     = new DependencyConfig();
            Parameters       parameters = new Parameters();

            config.Define(typeof(IItemWebService), typeof(MockItemWebService));
            DependencyContainer container = new DependencyContainer(config);

            container.ResolveDependencies(this, parameters);
        }
예제 #4
0
        public void DependencyContainerTest()
        {
            DependencyConfig config     = new DependencyConfig();
            Parameters       parameters = new Parameters();

            parameters.Add("StringProperty2", "Test");
            config.Define(typeof(DITestInterface), typeof(DITestInterfaceImpl));
            DependencyContainer container = new DependencyContainer(config);
            var obj = new DITestClass();

            container.ResolveDependencies(obj, parameters);

            Assert.True(obj.StringProperty2.Equals("Test"));
            Assert.True(obj.InterfaceProperty.GetType().Equals(typeof(DITestInterfaceImpl)));
        }
        public void BeforeTests()
        {
            string          DataBasePath = System.IO.Path.Combine(Environment.CurrentDirectory, "database.db");
            DataBaseService dbService    = new DataBaseService(DataBasePath);

            dbService.Initialize("dbDemo");

            DependencyConfig config     = new DependencyConfig();
            Parameters       parameters = new Parameters();

            config.Define(typeof(ICustomerDataBaseService), typeof(MockCustomerDataBaseService));
            DependencyContainer container = new DependencyContainer(config);

            container.ResolveDependencies(this, parameters);

            service.DBService = dbService;
        }
예제 #6
0
        partial void PushLoginButton(UIButton sender)
        {
            DependencyConfig config = new DependencyConfig();

            config.Define(typeof(IServiceAuthenticator), typeof(OnlineModeAuthenticator));

            OperationProcessor processor = OperationProcessor.Instance;

            processor.DepedencyContainer.Config = config;
            Parameters parameters = new Parameters();

            parameters ["Credentials"] = new List <string> ()
            {
                LoginTextField.Text, PasswordTextField.Text
            };
            processor.PerformOperation(typeof(LoginOperation), parameters, (Parameters result) => {
                InvokeOnMainThread(() => {
                    NavigationViewController navigationController = (NavigationViewController)NavigationController;
                    navigationController.PushLandingViewController();
                });
            }, null);
        }