Пример #1
0
            public void When_executing_LandingSurfaceSizeCommand_sets_LandingSurface_as_command_receiver()
            {
                var expectedLandingSurface = new Mock<ILandingSurface>();
                var landingSurfaceSizeCommand = new Mock<ILandingSurfaceSizeCommand>();
                landingSurfaceSizeCommand.Setup(x => x.GetCommandType()).Returns(CommandType.LandingSurfaceSizeCommand);

                var commandInvoker = new CommandInvoker(null);
                commandInvoker.Assign(new[] { landingSurfaceSizeCommand.Object });
                commandInvoker.SetLandingSurface(expectedLandingSurface.Object);

                commandInvoker.InvokeAll();

                landingSurfaceSizeCommand.Verify(
                    x => x.SetReceiver(expectedLandingSurface.Object), Times.Once());
            }
Пример #2
0
            public void When_executing_RoverDeployCommand_sets_LandingSurface_and_new_Rover_as_command_receivers()
            {
                var expectedRover = new Mock<IRover>();
                var expectedLandingSurface = new Mock<ILandingSurface>();

                var mockRoverDeployCommand = new Mock<IRoverDeployCommand>();
                mockRoverDeployCommand.Setup(x => x.GetCommandType()).Returns(CommandType.RoverDeployCommand);

                Func<IRover> mockRoverFactory = () => expectedRover.Object;

                var commandInvoker = new CommandInvoker(mockRoverFactory);
                commandInvoker.Assign(new[]{mockRoverDeployCommand.Object});
                commandInvoker.SetLandingSurface(expectedLandingSurface.Object);
                commandInvoker.SetRovers(new List<IRover>());

                commandInvoker.InvokeAll();

                mockRoverDeployCommand.Verify(
                    x => x.SetReceivers(expectedRover.Object, expectedLandingSurface.Object), Times.Once());
            }
Пример #3
0
 public void Accepts_new_LandingSurface()
 {
     var mockLandingSurface = new Mock<ILandingSurface>();
     var commandInvoker = new CommandInvoker(null);
     Assert.DoesNotThrow(() =>
         commandInvoker.SetLandingSurface(mockLandingSurface.Object));
 }