Example #1
0
        public void TestDefaultImplOnInterface()
        {
            IAnInterface impl = (IAnInterface)TangFactory.GetTang().NewInjector().GetInstance(typeof(IAnInterface));

            Assert.IsNotNull(impl);
            impl.aMethod();
        }
        public void JumpToInterface(IAnInterface myObject)
        {
            // so from here I would click on either the parameter or use below and say take me to implemention (select appropriate),
            // alternatively I may say go to Interface

            myObject.DoesSomething();
        }
Example #3
0
        private RepositoryItem MyBarRepository(IAnInterface arg)
        {
            var repositoryItem = new RepositoryItemProgressBar();

            repositoryItem.Minimum = 0;
            repositoryItem.Maximum = 100;
            return(repositoryItem);
        }
 protected override void Context()
 {
     base.Context();
     sut          = new Cache <string, IAnInterface>();
     _objectToAdd = new AnImplementation {
         FirstName = "toto"
     };
 }
        public Form1()
        {
            InitializeComponent();
            _object1 = new AnImplementation();

            _object1.FirstName = "Good name1";
            screenBinderDirect.BindTo(_object1);
        }
 protected override void Context()
 {
     base.Context();
     _objectToAdd = new AnImplementation {
         FirstName = "toto"
     };
     sut.Add(_objectToAdd);
 }
Example #7
0
        protected override void Context()
        {
            base.Context();
            _references = new WeakReference(_source);
            sut.Bind(_source);

            _anotherElement = new AnImplementation();
        }
Example #8
0
        private RepositoryItem MyRepoForDouble(IAnInterface source)
        {
            var repositoryItem = new RepositoryItemTrackBar();

            repositoryItem.TickStyle = TickStyle.TopLeft;
            repositoryItem.Minimum   = 0;
            repositoryItem.Maximum   = 100;
            return(repositoryItem);
        }
Example #9
0
        private IEnumerable <string> getComboBoxValue(IAnInterface item)
        {
            if (item.ValueFromList.Equals("value1"))
            {
                return new[] { "Joe", "Juri", "Mike" }
            }
            ;

            return(new[] { "Maman", "Papa", "Oma" });
        }
Example #10
0
 protected override void Context()
 {
     base.Context();
     _implementation4       = new AnImplementation();
     sut.CollectionChanged += (o, e) =>
     {
         _eventRaised = true;
         _action      = e.Action;
     };
 }
    // explicitly implement aMethodBeta() when called from interface reference
    object IGreatInterface.aMethodBeta(IAnInterface parameter)
    {
        // do whatever you'd do on IAnInterface itself...
        var newParam = parameter as SomeSubClass;

        if (newParam != null)
        {
            aMethodBeta(newParam);
        }
        // otherwise do some other action...
    }
 protected override void Context()
 {
     base.Context();
     _totoImplementation = new AnImplementation {
         FirstName = "Toto"
     };
     _harryImplementation = new AnImplementation {
         FirstName = "Toto"
     };
     _someImplementations = new Collection <IAnInterface>
     {
         _totoImplementation,
         _harryImplementation
     };
 }
Example #13
0
 public RootImplementation([Parameter(typeof(TestConfigurationModuleBuilder.RequiredString))] string requiredString,
                           [Parameter(typeof(TestConfigurationModuleBuilder.OptionalString))] string optionalString,
                           [Parameter(typeof(TestConfigurationModuleBuilder.NamedParameterInteger))] int anInt,
                           [Parameter(typeof(TestConfigurationModuleBuilder.NamedParameterDouble))] double aDouble,
                           IAnInterface anInterface,
                           InjectableClass injectableClass,
                           SetOfImplementations setOfImplementations,
                           SetOfBaseTypes setOfBaseTypes,
                           CyclicDependency cyclicDependency)
 {
                         this.requiredString = requiredString;
                         this.optionalString = optionalString;
                         this.anInterface = anInterface;
                         this.anInt = anInt;
                         this.aDouble = aDouble;
                         this.injectableClass = injectableClass;
                         this.setOfImplementations = setOfImplementations;
                         this.setOfBaseTypes = setOfBaseTypes;
                         //// this.listOfBaseTypes = listOfBaseTypes;  // TODO: to recover once Avro NuGet support it
                         this.cyclicDependency = cyclicDependency;
 }
Example #14
0
 public RootImplementation([Parameter(typeof(TestConfigurationModuleBuilder.RequiredString))] string requiredString,
                           [Parameter(typeof(TestConfigurationModuleBuilder.OptionalString))] string optionalString,
                           [Parameter(typeof(TestConfigurationModuleBuilder.NamedParameterInteger))] int anInt,
                           [Parameter(typeof(TestConfigurationModuleBuilder.NamedParameterDouble))] double aDouble,
                           IAnInterface anInterface,
                           InjectableClass injectableClass,
                           SetOfImplementations setOfImplementations,
                           SetOfBaseTypes setOfBaseTypes,
                           CyclicDependency cyclicDependency)
 {
     this.requiredString       = requiredString;
     this.optionalString       = optionalString;
     this.anInterface          = anInterface;
     this.anInt                = anInt;
     this.aDouble              = aDouble;
     this.injectableClass      = injectableClass;
     this.setOfImplementations = setOfImplementations;
     this.setOfBaseTypes       = setOfBaseTypes;
     //// this.listOfBaseTypes = listOfBaseTypes;  // TODO: to recover once Avro NuGet support it
     this.cyclicDependency = cyclicDependency;
 }
 protected override void Context()
 {
     base.Context();
     _defaultValue = A.Fake <IAnInterface>();
     sut           = new Cache <string, IAnInterface>(o => o.FirstName, s => _defaultValue);
 }
Example #16
0
            public async Task Handle(IAnInterface message)
            {
                Data.CorrelationId = message.CorrelationId;

                _counter.Decrement();
            }
 protected override void Context()
 {
     base.Context();
     _implementation3 = new AnImplementation();
 }
Example #18
0
 private void OnLastNameSet(IAnInterface arg1, PropertyValueSetEventArgs <string> arg2)
 {
     AddLine($"Last name set: new = {arg2.NewValue}, old = {arg1.LastName}");
 }
Example #19
0
 public MyFormmater(IAnInterface anInterface)
 {
     _anInterface = anInterface;
 }
Example #20
0
 protected override void Because()
 {
     _result1 = sut.Resolve <IAnInterface>("toto");
 }
 protected override void Context()
 {
     _object1 = new AnotherImplementation();
     _object2 = new AnotherImplementation();
 }
 private void OnLastNameSet(IAnInterface arg1, PropertyValueSetEventArgs <string> arg2)
 {
 }
Example #23
0
 private void OnBoolValueSet(IAnInterface arg1, PropertyValueSetEventArgs <bool> arg2)
 {
     AddLine($"Boolean value was set from : {(arg2.OldValue ? "checked" : "unchecked")} to {(arg2.NewValue ? "checked" : "unchecked")}");
 }
 private void OnValueSet(IAnInterface arg1, PropertyValueSetEventArgs <double> arg2)
 {
 }
Example #25
0
 private RepositoryItem RepositoryItemButton(IAnInterface arg)
 {
     return(_repositoryItemButton);
 }
Example #26
0
 private void OnValueSet(IAnInterface arg1, PropertyValueSetEventArgs <double> arg)
 {
     AddLine($"Value set: new = {arg.NewValue}, old = {arg1.Value}");
 }
Example #27
0
 private IFormatter <double> GetFormat(IAnInterface anInterface)
 {
     return(new MyFormmater(anInterface));
 }
Example #28
0
 protected override void Because()
 {
     _result1 = sut.Resolve <IAnInterface>(typeof(IAnInterface));
 }
Example #29
0
 private void AutoBindOnValueSet(IAnInterface arg1, PropertyValueSetEventArgs <int> arg2)
 {
     AddLine($"Autobind value was set from : {arg2.OldValue} to {arg2.NewValue}");
 }
Example #30
0
 protected override void Because()
 {
     _implementation4 = new AnImplementation();
     sut.Add("tralala", _implementation4);
 }
 public void AddChild(IAnInterface child)
 {
     _children.Add(child);
 }
Example #32
0
        public FormTest()
        {
            InitializeComponent();
            _screenBinder  = new ScreenBinder <IAnInterface>();
            _screenBinder2 = new ScreenBinder <IAnInterface>();
            _gridBinder    = new GridViewBinder <IAnInterface>(gridView1);
            InitBinding();

            _repositoryItemButton = new RepositoryItemButtonEdit();
            _repositoryItemButton.Buttons.Add(new EditorButton());

            _repositoryItemButton.AutoHeight = false;

            _repositoryItemButton.Buttons.Add(new EditorButton(ButtonPredefines.Glyph, "AAAA", -1, true, true, false, HorzAlignment.Center, null));

            _source = new AnImplementation {
                FirstName = "Joe", LastName = "Black", Value = 10
            };
            _source.Log = new List <string> {
                "Line1", "Line2"
            };
            _screenBinder.BindToSource(_source);
            _screenBinder2.BindToSource(_source);

            var obj2 = new AnImplementation {
                FirstName = "Jean", LastName = "Moulin", Value = 20
            };
            var obj3 = new AnImplementation {
                FirstName = "Robes", LastName = "Pierre", Value = 30
            };

            var sourceList = new List <IAnInterface> {
                _source, obj2, obj3
            };

            _gridBinder.BindToSource(GetSource(sourceList));

            var edit0 = gridView1.Columns[0].RealColumnEdit;
            var edit1 = gridView1.Columns[1].RealColumnEdit;
            var edit2 = gridView1.Columns[2].RealColumnEdit;
            var edit3 = gridView1.Columns[3].RealColumnEdit;

            bool equal = false;

            if (ReferenceEquals(edit0, edit1))
            {
                equal = true;
            }

            if (ReferenceEquals(edit0, edit2))
            {
                equal = true;
            }

            if (ReferenceEquals(edit0, edit3))
            {
                equal = true;
            }

            if (ReferenceEquals(edit1, edit2))
            {
                equal = true;
            }

            if (ReferenceEquals(edit1, edit3))
            {
                equal = true;
            }

            if (ReferenceEquals(edit2, edit3))
            {
                equal = true;
            }
        }