예제 #1
0
        public void Create_PropWithoutInpcAttribute_InpcCallIsNotInjected()
        {
            var injectedVm = AopInpcFactory.Create <ViewModel>();

            injectedVm.PropertyChanged += (sender, args) => throw new InvalidOperationException(args.PropertyName);

            injectedVm.Prop = 5;
        }
예제 #2
0
        public void Create_NullAsEmptyCtorArgument_InpcCallInjected()
        {
            var injectedVm = AopInpcFactory.Create <ViewModel>(null);

            injectedVm.PropertyChanged += (sender, args) => throw new InvalidOperationException(args.PropertyName);

            var ex = Assert.Throws <InvalidOperationException>(() => injectedVm.InjectProp = 5);

            Assert.Equal(nameof(ViewModel.InjectProp), ex.Message);
        }