예제 #1
0
		public void Get_UsingDefaultBuilderFactory_ShouldReturnCorrectValue(
			string name,
			ISchedulers schedulers)
		{
			//arrange
			var sut = new CommandBuilderProvider(schedulers);

			//act
			var actual = sut.Get(name);

			//assert
			actual.Should().NotBeNull().And.BeOfType<CommandBuilder>();
		}
예제 #2
0
		public void Get_UsingBuilderFactory_ShouldReturnCorrectValue(
			string name,
			ISchedulers schedulers,
			ICommandBuilder expected)
		{
			//arrange
			var sut = new CommandBuilderProvider(schedulers, (action, schedulers1, arg3) => expected);

			//act
			var actual = sut.Get(name);

			//assert
			actual.Should().Be(expected);
		}
예제 #3
0
		public void Get_ShouldCallAccept(
			string name,
			ISchedulers schedulers,
		 	Mock<ICommandBuilder> commandBuilder,
			Mock<IMvvmCommand> command,
			IMvvmCommandVisitor visitor)
		{
            //arrange                        
            Action<ICommand> action = null;
			var sut = new CommandBuilderProvider(schedulers, (action1, schedulers1, n) =>
			{
				action = action1;
				return commandBuilder.Object;
			});

			sut.AddVisitor(visitor);

			//act
			sut.Get("");
			action(command.As<ICommand>().Object);

			//assert
			command.Verify(c => c.Accept(visitor));
		}
예제 #4
0
		public void CopyVisitors_ShouldCallAddVisitor(
		  CommandBuilderProvider sut,
		  IMvvmCommandVisitor[] visitors,
		  Mock<ICommandBuilderProvider> other)
		{
			//arrange
			foreach (var mvvmCommandVisitor in visitors)
			{
				sut.AddVisitor(mvvmCommandVisitor);
				other.Setup(c => c.AddVisitor(mvvmCommandVisitor)).Verifiable();
			}

			//act
			sut.CopyVisitors(other.Object);

			//assert
			other.Verify();
		}