Example #1
0
        public void ShouldSendGrillFirmware()
        {
            // Arrange
            var sut = new GrillEmulator();

            // Act
            var response = sut.HandleRequest(new GrillFirmwareRequest()) as MessageResponse;

            // Assert
            Assert.NotNull(response);
            Assert.True(response.Message == sut.Firmware);
        }
Example #2
0
        public void ShouldSendGrillInfo()
        {
            // Arrange
            var sut = new GrillEmulator();

            // Act
            var response = sut.HandleRequest(new GrillInfoRequest()) as GrillInfoResponse;

            // Assert
            Assert.NotNull(response);
            Assert.True(response.GrillState == GrillState.OFF);
            Assert.True(response.GrillTemp == sut.CurrentGrillTemp);
        }
Example #3
0
        public void ShouldPowerOffGrill()
        {
            // Arrange
            var sut = new GrillEmulator(isOn: true);

            // Act
            var initialState = sut.IsOn;
            var response     = sut.HandleRequest(new PowerOffRequest()) as MessageResponse;

            // Assert
            Assert.NotNull(response);
            Assert.True(initialState);
            Assert.False(sut.IsOn);
            Assert.Equal(Constants.ResponseCodes.OK, response.Message);
        }
Example #4
0
        public void ShouldSetGrillTemp()
        {
            // Arrange
            var sut = new GrillEmulator(currentGrillTemp: 0);

            // Act
            var initialState = sut.CurrentGrillTemp;
            var request      = new SetGrillTempRequest(temp: 200);

            var response = sut.HandleRequest(request) as MessageResponse;

            // Assert
            Assert.NotNull(response);
            Assert.Equal(0, initialState);
            Assert.Equal(200, sut.CurrentGrillTemp);
            Assert.Equal(Constants.ResponseCodes.OK, response.Message);
        }