コード例 #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);
        }