コード例 #1
0
        public void NotifyNotExecuting_ShouldCallInner(
            [Frozen] Mock <ICanExecuteStrategy <object> > inner,
            ObserveCanExecuteStrategy <object> sut,
            object arg)
        {
            //arrange

            //act
            sut.NotifyNotExecuting(arg);

            //assert
            inner.Verify(c => c.NotifyNotExecuting(arg));
        }
コード例 #2
0
		public void NotifyExecuting_ShouldCallInner(
			[Frozen]Mock<ICanExecuteStrategy<object>> inner,
		  ObserveCanExecuteStrategy<object> sut,
			object arg)
		{
			//arrange

			//act
			sut.NotifyExecuting(arg);

			//assert
			inner.Verify(c => c.NotifyExecuting(arg));
		}
コード例 #3
0
        public void CanExecute_WhenObservableIsFalse_ShouldReturnFalse(
            [Frozen] Subject <bool> canExecuteObservable,
            ObserveCanExecuteStrategy <object> sut,
            object arg)
        {
            //arrange
            canExecuteObservable.OnNext(false);

            //act
            var actual = sut.CanExecute(arg);

            //assert
            actual.Should().BeFalse();
        }
コード例 #4
0
        public void CanExecute_WhenObservableHasNoValue_ShouldReturnInner(
            [Frozen] Mock <ICanExecuteStrategy <object> > inner,
            ObserveCanExecuteStrategy <object> sut,
            object arg)
        {
            //arrange
            inner.Setup(i => i.CanExecute(arg)).Returns(true);

            //act
            var actual = sut.CanExecute(arg);

            //assert
            actual.Should().BeTrue();
        }
コード例 #5
0
        public void CanExecute_WhenObservableIsTrue_ShouldReturnInner(
            [Frozen] Subject <bool> canExecuteObservable,
            [Frozen] Mock <ICanExecuteStrategy <object> > inner,
            ObserveCanExecuteStrategy <object> sut,
            object arg)
        {
            //arrange
            inner.Setup(i => i.CanExecute(arg)).Returns(false);
            canExecuteObservable.OnNext(true);

            //act
            var actual = sut.CanExecute(arg);

            //assert
            actual.Should().BeFalse();
        }
コード例 #6
0
        public void CanExecuteChanged_WhenObservableYieldValue_ShouldYieldValue(
            [Frozen] Subject <bool> canExecuteObservable,
            [Frozen] Mock <ICanExecuteStrategy <object> > inner,
            ObserveCanExecuteStrategy <object> sut,
            TestSchedulers schedulers,
            object arg)
        {
            //arrange
            var observer = schedulers.CreateObserver <Unit>();

            sut.CanExecuteChanged.Subscribe(observer);


            //act
            canExecuteObservable.OnNext(true);

            //assert
            observer.Values().Should().HaveCount(1);
        }
コード例 #7
0
 public void Sut_ShouldBeCanExecuteStrategy(
     ObserveCanExecuteStrategy <object> sut)
 {
     sut.Should().BeAssignableTo <ICanExecuteStrategy <object> >();
 }
コード例 #8
0
		public void Sut_ShouldBeCanExecuteStrategy(
		  ObserveCanExecuteStrategy<object> sut)
		{
			sut.Should().BeAssignableTo<ICanExecuteStrategy<object>>();
		}
コード例 #9
0
		public void CanExecuteChanged_WhenObservableYieldValue_ShouldYieldValue(
			[Frozen]Subject<bool> canExecuteObservable,
			[Frozen]Mock<ICanExecuteStrategy<object>> inner,
			ObserveCanExecuteStrategy<object> sut,
			TestSchedulers schedulers,
			object arg)
		{
			//arrange
			var observer = schedulers.CreateObserver<Unit>();
			sut.CanExecuteChanged.Subscribe(observer);
			

			//act
			canExecuteObservable.OnNext(true);

			//assert
			observer.Values().Should().HaveCount(1);
		}
コード例 #10
0
		public void CanExecute_WhenObservableIsTrue_ShouldReturnInner(
			[Frozen]Subject<bool> canExecuteObservable,
			[Frozen]Mock<ICanExecuteStrategy<object>> inner,
			ObserveCanExecuteStrategy<object> sut,
			object arg)
		{
			//arrange
			inner.Setup(i => i.CanExecute(arg)).Returns(false);
			canExecuteObservable.OnNext(true);

			//act
			var actual = sut.CanExecute(arg);

			//assert
			actual.Should().BeFalse();
		}
コード例 #11
0
		public void CanExecute_WhenObservableIsFalse_ShouldReturnFalse(
			[Frozen]Subject<bool> canExecuteObservable,
			ObserveCanExecuteStrategy<object> sut,
			object arg)
		{
			//arrange
			canExecuteObservable.OnNext(false);

			//act
			var actual = sut.CanExecute(arg);

			//assert
			actual.Should().BeFalse();
		}
コード例 #12
0
		public void CanExecute_WhenObservableHasNoValue_ShouldReturnInner(
			[Frozen]Mock<ICanExecuteStrategy<object>> inner,
			ObserveCanExecuteStrategy<object> sut,
			object arg)
		{
			//arrange
			inner.Setup(i => i.CanExecute(arg)).Returns(true);

			//act
			var actual = sut.CanExecute(arg);

			//assert
			actual.Should().BeTrue();
		}