Example #1
0
    public int MEM;   //Used by Get(Final)Status

    public JobEntry(Houston houston, TabControl theTabs, TabPage tabInput, TabPage tabLog)
    {
        _houston  = houston;
        _theTabs  = theTabs;
        _tabInput = tabInput;
        _tabLog   = tabLog;

        _inputFile        = new OpenAndSave();
        _inputFile.Filter = "SFBox Input Files (*.in)|*.in|Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
        //_inputFile.Multiselect = true; //werkt niet
        _inputFile.ReadData          += new OpenAndSave.ReadDataEventHandler(ReadData);
        _inputFile.WriteData         += new OpenAndSave.WriteDataEventHandler(WriteData);
        _inputFile.RevertData        += new OpenAndSave.RevertDataEventHandler(RevertData);
        _inputFile.FileNameChanged   += new OpenAndSave.FileNameChangedEventHandler(FileNameChanged_Handler);
        _inputFile.FolderNameChanged += new OpenAndSave.FolderNameChangedEventHandler(FolderNameChanged_Handler);

        _fileWatch = new FileSystemWatcher();
        _fileWatch.NotifyFilter = NotifyFilters.LastWrite;
        _fileWatch.Changed     += FileChanged_Handler;


        for (int i = 1; i < Enum.GetNames(typeof(Display)).Length; i++)
        { //Init the subitems
            SubItems.Add("");
        }

        SetupJob();
    }
Example #2
0
        public void MustSetUpSurfaceThrowException(string command)
        {
            var serviceProvider = Services.CreateAndGetServices();

            var houston = new Houston(serviceProvider);

            var action = new Action(() => houston.SendCommand(command));

            action.Should().Throw <Exception>().WithMessage("surface is not set up");
        }
Example #3
0
        public void WrongCommandThrowException(string command)
        {
            var serviceProvider = Services.CreateAndGetServices();

            var houston = new Houston(serviceProvider);

            var action = new Action(() => houston.SendCommand(command));

            action.Should().Throw <Exception>().WithMessage("command is not provided");
        }
Example #4
0
 static void MessageBoxShow(Houston owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     if (!owner.InvokeRequired)
     {
         MessageBox.Show(owner, text, caption, buttons, icon);
     }
     else
     {
         owner.Invoke(new MessageBoxShowDelegate(MessageBoxShow), new object[] { owner, text, caption, buttons, icon });
     }
 }
 public SpaceCenterShould()
 {
     _mockLandingSurface = new Mock <ILandingSurface>();
     _mockSquad          = new Mock <ISquad>();
     _commandManager     = new CommandManager();
     _sut       = new Houston(_mockLandingSurface.Object, _commandManager);
     _sut.Order = new Order()
     {
         Instructions    = "LMLMLMMR",
         LandingPosition = new Position(1, 1),
         Orientation     = Orientation.N
     };
 }
Example #6
0
        public void LocationBoundThrowException(string plataeuCommand, string command)
        {
            var serviceProvider = Services.CreateAndGetServices();

            var houston = new Houston(serviceProvider);

            houston.SendCommand(plataeuCommand);

            var action = new Action(() => houston.SendCommand(command));


            action.Should().Throw <Exception>().WithMessage("location is not valid");
        }
Example #7
0
        public void ACircleReturnsToInitialPosition(string command)
        {
            // Arrange
            var serviceProvider = Services.CreateAndGetServices();

            var houston = new Houston(serviceProvider);

            houston.SendCommand("2 2");
            houston.SendCommand("1 1 W");
            var rover = serviceProvider.GetService <IRoverManager>().Rover;

            // Act
            houston.SendCommand(command);

            // Assert
            rover.Should().NotBeNull();
            rover.X.Should().Be(1);
            rover.Y.Should().Be(1);
            rover.Direction.Should().Be(Directions.W);
        }
Example #8
0
        public void CreatePlatue(string command)
        {
            // Arrange
            var serviceProvider = Services.CreateAndGetServices();
            var commands        = command.Split(' ');
            var width           = int.Parse(commands[0]);
            var height          = int.Parse(commands[1]);

            ISpaceCenter houston = new Houston(serviceProvider);
            var          plateue = serviceProvider.GetService <ISurface>();


            houston.SendCommand(command);


            plateue.Should().NotBeNull();
            plateue.Size.Should().NotBeNull();
            plateue.Size.SurfaceModel.Width.Should().Be(width);
            plateue.Size.SurfaceModel.Height.Should().Be(height);
        }