public void ResponseParse_SetTemperatureTripleMode_Test() { SmartHomeResponse responseFromString = JsonConvert.DeserializeObject <SmartHomeResponse>(SET_T_TEMPERATURE_TRIPLEMODE_RESPONSE); //Context check Assert.NotNull(responseFromString.Context); Assert.NotNull(responseFromString.Context.Properties); Assert.Equal(5, responseFromString.Context.Properties.Count); // Property 1 TestPropertySetpoint(responseFromString.Context.Properties[0], PropertyNames.LOWER_SETPOINT, Namespaces.ALEXA_THERMOSTATCONTROLLER, DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null, 68.0, Scale.FAHRENHEIT); // Property 2 TestPropertySetpoint(responseFromString.Context.Properties[1], PropertyNames.TARGET_SETPOINT, Namespaces.ALEXA_THERMOSTATCONTROLLER, DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null, 72.0, Scale.FAHRENHEIT); // Property 3 TestPropertySetpoint(responseFromString.Context.Properties[2], PropertyNames.UPPER_SETPOINT, Namespaces.ALEXA_THERMOSTATCONTROLLER, DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null, 76.0, Scale.FAHRENHEIT); // Property 4 TestPropertyThermostatMode(responseFromString.Context.Properties[3], DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null, ThermostatModes.AUTO); // Property 5 TestFunctionsV3.TestBasicHealthCheckProperty(responseFromString.Context.Properties[4], ConnectivityModes.OK, DateTime.Parse("2017-09-27T18:30:30.45Z")); //Event Check TestFunctionsV3.TestBasicEventWithEmptyPayload(responseFromString, "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", ScopeTypes.BearerToken, "access-token-from-Amazon", "endpoint-001"); }
public void ResponseParse_PlaybackResponse_Test() { SmartHomeResponse responseFromString = JsonConvert.DeserializeObject <SmartHomeResponse>(PLAYBACK_RESPONSE); //Context check Assert.NotNull(responseFromString.Context); Assert.NotNull(responseFromString.Context.Properties); Assert.Equal(1, responseFromString.Context.Properties.Count); // Property 2 TestFunctionsV3.TestBasicHealthCheckProperty(responseFromString.Context.Properties[0], ConnectivityModes.OK, DateTime.Parse("2017-09-27T18:30:30.45Z")); //Event Check TestFunctionsV3.TestBasicEventWithEmptyPayload(responseFromString, "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", ScopeTypes.BearerToken, "access-token-from-Amazon", "endpoint-001"); }
public void ResponseParse_Unlock_Test() { SmartHomeResponse responseFromString = JsonConvert.DeserializeObject <SmartHomeResponse>(UNLOCK_RESPONSE); //Context check Assert.NotNull(responseFromString.Context); Assert.NotNull(responseFromString.Context.Properties); Assert.Equal(2, responseFromString.Context.Properties.Count); // Property 1 TestFunctionsV3.TestContextProperty(responseFromString.Context.Properties[0], PropertyNames.LOCK_STATE, Namespaces.ALEXA_LOCKCONTROLLER, DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null); Assert.Equal(typeof(LockModes), responseFromString.Context.Properties[0].Value.GetType()); Assert.Equal(LockModes.UNLOCKED, responseFromString.Context.Properties[0].Value); // Property 2 TestFunctionsV3.TestBasicHealthCheckProperty(responseFromString.Context.Properties[1], ConnectivityModes.OK, DateTime.Parse("2017-09-27T18:30:30.45Z")); //Event Check TestFunctionsV3.TestBasicEventWithEmptyPayload(responseFromString, "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", ScopeTypes.BearerToken, "access-token-from-Amazon", "endpoint-001"); }
public void ResponseParse_SetColor_Test() { SmartHomeResponse responseFromString = JsonConvert.DeserializeObject <SmartHomeResponse>(SET_COLOR_RESPONSE); //Context check Assert.NotNull(responseFromString.Context); Assert.NotNull(responseFromString.Context.Properties); Assert.Equal(2, responseFromString.Context.Properties.Count); // Property 1 TestFunctionsV3.TestContextProperty(responseFromString.Context.Properties[0], PropertyNames.COLOR, Namespaces.ALEXA_COLORCONTROLLER, DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null); Assert.Equal(typeof(Color), responseFromString.Context.Properties[0].Value.GetType()); Color color = responseFromString.Context.Properties[0].Value as Color; Assert.Equal(0.6524, color.Brightness); Assert.Equal(350.5, color.Hue); Assert.Equal(0.7138, color.Saturation); // Property 2 TestFunctionsV3.TestBasicHealthCheckProperty(responseFromString.Context.Properties[1], ConnectivityModes.OK, DateTime.Parse("2017-09-27T18:30:30.45Z")); //Event Check TestFunctionsV3.TestBasicEventWithEmptyPayload(responseFromString, "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", ScopeTypes.BearerToken, "access-token-from-Amazon", "endpoint-001"); }
public void ResponseParse_ChannelResponse_Test() { SmartHomeResponse responseFromString = JsonConvert.DeserializeObject <SmartHomeResponse>(CHANNEL_RESPONSE); //Context check Assert.NotNull(responseFromString.Context); Assert.NotNull(responseFromString.Context.Properties); Assert.Equal(2, responseFromString.Context.Properties.Count); // Property 1 TestFunctionsV3.TestContextProperty(responseFromString.Context.Properties[0], PropertyNames.CHANNEL, Namespaces.ALEXA_CHANNELCONTROLLER, DateTime.Parse("2017-09-27T18:30:30.45Z"), 200, null); Assert.Equal(typeof(Channel), responseFromString.Context.Properties[0].Value.GetType()); Channel channel = responseFromString.Context.Properties[0].Value as Channel; Assert.Null(channel.Uri); Assert.Equal("callsign2", channel.AffiliateCallSign); Assert.Equal("callsign1", channel.CallSign); Assert.Equal("1234", channel.Number); // Property 2 TestFunctionsV3.TestBasicHealthCheckProperty(responseFromString.Context.Properties[1], ConnectivityModes.OK, DateTime.Parse("2017-09-27T18:30:30.45Z")); //Event Check TestFunctionsV3.TestBasicEventWithEmptyPayload(responseFromString, "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", ScopeTypes.BearerToken, "access-token-from-Amazon", "endpoint-001"); }