public void RequestCreation_ChangeChannel_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(CHANGE_CHANNEL); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_CHANNELCONTROLLER, HeaderNames.CHANGE_CHANNEL); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(ChangeChannelRequestPayload), requestFromString.GetPayloadType()); ChangeChannelRequestPayload payload = (requestFromString.Directive.Payload as ChangeChannelRequestPayload); //Channel Assert.NotNull(payload.Channel); Assert.Equal("1234", payload.Channel.Number); Assert.Equal("KSTATION1", payload.Channel.CallSign); Assert.Equal("KSTATION2", payload.Channel.AffiliateCallSign); Assert.Equal("someUrl", payload.Channel.Uri); //ChannelMetaData Assert.NotNull(payload.ChannelMetaData); Assert.Equal("Alternate Channel Name", payload.ChannelMetaData.Name); Assert.Equal("urlToImage", payload.ChannelMetaData.Image); }
public void RequestCreation_Unlock_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(UNLOCK_REQUEST); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_LOCKCONTROLLER, HeaderNames.UNLOCK); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(Payload), requestFromString.GetPayloadType()); }
public void RequestCreation_AdjustPowerLevel_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(REPORT_STATE); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", Namespaces.ALEXA, HeaderNames.REPORT_STATE); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "appliance-001"); TestFunctionsV3.TestBearerTokenWithPartitionV3(requestFromString.Directive.Endpoint.Scope, "some-access-token", "Room101", "some-user-id"); //Payload Check Assert.NotNull(requestFromString.Directive.Payload); Assert.Equal(typeof(Payload), requestFromString.GetPayloadType()); }
public void RequestCreation_AdjustBrightness_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(ADJUST_BRIGHTNESS_REQUEST); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_BRIGHTNESSCONTROLLER, HeaderNames.ADJUST_BRIGHTNESS); Assert.Equal(requestFromString.Directive.Header.CorrelationToken, "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg=="); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(AdjustBrightnessRequestPayload), requestFromString.GetPayloadType()); Assert.Equal(-25, (requestFromString.Directive.Payload as AdjustBrightnessRequestPayload).BrightnessDelta); }
public void RequestCreation_IncreaseColorTemperature_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(INCREASE_COLORTEMPERATURE); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_COLORTEMPERATURECONTROLLER, HeaderNames.INCREASE_COLORTEMPERATURE); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(Payload), requestFromString.GetPayloadType()); Payload payload = (requestFromString.Directive.Payload as Payload); Assert.NotNull(payload); }
public void RequestCreation_AdjustTemperature_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(ADJUST_T_TEMPERATURE); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_THERMOSTATCONTROLLER, HeaderNames.ADJUSTTARGETTEMPERATURE); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(AdjustTargetTemperatureRequestPayload), requestFromString.GetPayloadType()); AdjustTargetTemperatureRequestPayload payload = (requestFromString.Directive.Payload as AdjustTargetTemperatureRequestPayload); //Channel Assert.NotNull(payload); TestSetpoint(payload.TargetSetpointDelta, -2.0, Scale.FAHRENHEIT); }
public void RequestCreation_SelectInput_Request_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(SELECT_INPUT_REQUEST); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_INPUTCONTROLLER, HeaderNames.SELECT_INPUT); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(SelectInputRequestPayload), requestFromString.GetPayloadType()); SelectInputRequestPayload payload = (requestFromString.Directive.Payload as SelectInputRequestPayload); //Channel Assert.NotNull(payload); Assert.Equal("HDMI1", payload.Input); }
public void RequestCreation_AdjustPercentage_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(ADJUST_PERCENTAGE); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_PERCENTAGECONTROLLER, HeaderNames.ADJUST_PERCENTAGE); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(AdjustPercentageRequestPayload), requestFromString.GetPayloadType()); AdjustPercentageRequestPayload payload = (requestFromString.Directive.Payload as AdjustPercentageRequestPayload); //Channel Assert.NotNull(payload); Assert.Equal(-20, payload.PercentageDelta); }
public void RequestCreation_SetColor_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(SET_COLOR_REQUEST); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_COLORCONTROLLER, HeaderNames.SET_COLOR); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(SetColorRequestPayload), requestFromString.GetPayloadType()); SetColorRequestPayload payload = (requestFromString.Directive.Payload as SetColorRequestPayload); Assert.NotNull(payload.Color); Assert.Equal(350.5, payload.Color.Hue); Assert.Equal(0.7138, payload.Color.Saturation); Assert.Equal(0.6524, payload.Color.Brightness); }
public void RequestCreation_CameraStream_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(INIT_CAMERA_STREAMS_REQUEST); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_CAMERASTREAMCONTROLLER, HeaderNames.INIT_CAMERA_STREAMS); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(InitializeCameraRequestPayload), requestFromString.GetPayloadType()); InitializeCameraRequestPayload payload = (requestFromString.Directive.Payload as InitializeCameraRequestPayload); Assert.NotNull(payload.CameraStreams); Assert.Equal(2, payload.CameraStreams.Count); TestRequestCameraStream(payload.CameraStreams[0], CameraProtocols.RTSP, 1920, 1080, CameraAuthorizationTypes.BEARER, VideoCodecs.H264, AudioCodecs.AAC); TestRequestCameraStream(payload.CameraStreams[1], CameraProtocols.RTSP, 1280, 720, CameraAuthorizationTypes.BEARER, VideoCodecs.MPEG2, AudioCodecs.G711); }
public void RequestCreation_SetThermostatmode_Test() { SmartHomeRequest requestFromString = JsonConvert.DeserializeObject <SmartHomeRequest>(SET_THERMOSTATMODE_REQUEST); //Directive Check Assert.NotNull(requestFromString.Directive); //Header Check TestFunctionsV3.TestHeaderV3(requestFromString.Directive.Header, "1bd5d003-31b9-476f-ad03-71d471922820", Namespaces.ALEXA_THERMOSTATCONTROLLER, HeaderNames.SET_THERMOSTATMODE); Assert.Equal("dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", requestFromString.Directive.Header.CorrelationToken); //Endpoint Check TestFunctionsV3.TestEndpointV3(requestFromString.Directive.Endpoint, "endpoint-001"); TestFunctionsV3.TestBearerTokenV3(requestFromString.Directive.Endpoint.Scope, "access-token-from-skill"); //Payload Check Assert.Equal(typeof(SetThermostadModeRequestPayload), requestFromString.GetPayloadType()); SetThermostadModeRequestPayload payload = (requestFromString.Directive.Payload as SetThermostadModeRequestPayload); //Channel Assert.NotNull(payload); Assert.NotNull(payload.ThermostatMode); Assert.Equal(ThermostatModes.COOL, payload.ThermostatMode.Value); Assert.Null(payload.ThermostatMode.CustomName); }