コード例 #1
0
        public void NotCrashWhenAddModelWithViewModelIsCalledWithNullViewModelCollection()
        {
            var connector = new TConnector
            {
                ModelCollection = new ObservableCollection <TestModel>()
            };

            Assert.DoesNotThrow(() => connector.Add(new TestModel(), new TestViewModel()));
        }
コード例 #2
0
        public void ModelAndViewModelCanBeAddedAtTheSameTime()
        {
            var modelCollection     = new ObservableCollection <TestModel>();
            var viewModelCollection = new ObservableCollection <IViewModel <TestModel> >();

            var connector = new TConnector
            {
                ModelCollection     = modelCollection,
                ViewModelCollection = viewModelCollection
            };

            var m  = new TestModel();
            var vm = new TestViewModel();

            connector.Add(m, vm);

            Assert.AreEqual(1, modelCollection.Count);
            Assert.AreEqual(1, viewModelCollection.Count);
            Assert.AreSame(m, modelCollection[0]);
            Assert.AreSame(vm, viewModelCollection[0]);
        }
コード例 #3
0
        public void ModelAndViewModelCanBeAddedAtTheSameTimeWithSimplifiedSyntaxIfTheyAreAlreadyConnected()
        {
            var modelCollection     = new ObservableCollection <TestModel>();
            var viewModelCollection = new ObservableCollection <IViewModel <TestModel> >();

            var connector = new TConnector
            {
                ModelCollection     = modelCollection,
                ViewModelCollection = viewModelCollection
            };

            var m  = new TestModel();
            var vm = new TestViewModel {
                Model = m
            };

            connector.Add(vm);

            Assert.AreEqual(1, modelCollection.Count);
            Assert.AreEqual(1, viewModelCollection.Count);
            Assert.AreSame(m, modelCollection[0]);
            Assert.AreSame(vm, viewModelCollection[0]);
        }
コード例 #4
0
        public void NotCrashWhenAddModelWithViewModelIsCalledWithBothCollectionBeingNull()
        {
            var connector = new TConnector();

            Assert.DoesNotThrow(() => connector.Add(new TestModel(), new TestViewModel()));
        }