public async Task TestGetTemperatureControlStatus() { var mockHttp = new MockHttpMessageHandler(); mockHttp.When($"{MockDigitalstromConnection.BaseUri}/json/apartment/getTemperatureControlStatus") .WithExactQueryString($"token={MockDigitalstromConnection.AppToken}") .Respond("application/json", @"{ ""result"": { ""zones"": [ { ""id"": 1, ""name"": ""RoomWithoutControl"", ""ControlMode"": 0, ""ControlState"": 0 }, { ""id"": 32001, ""name"": ""RoomFollowing"", ""ControlMode"": 2, ""ControlState"": 0, ""ControlValue"": 18, ""ControlValueTime"": ""2019-05-02T09:12:27Z"" }, { ""id"": 32027, ""name"": ""RoomWithControl"", ""ControlMode"": 1, ""ControlState"": 0, ""OperationMode"": 1, ""TemperatureValue"": 19.925, ""TemperatureValueTime"": ""2019-05-02T09:12:43Z"", ""NominalValue"": 20, ""NominalValueTime"": ""2018-12-08T18:10:44Z"", ""ControlValue"": 93, ""ControlValueTime"": ""2019-05-02T09:12:53Z"" } ] }, ""ok"": true }"); using var dsApiClient = new DigitalstromDssClient(mockHttp.AddAuthMock().ToMockProvider()); var result = await dsApiClient.GetTemperatureControlStatus(); Assert.Equal(32027, (int)result.Zones[2].Id); Assert.Equal("RoomWithControl", result.Zones[2].Name); Assert.Equal(1, result.Zones[2].ControlMode); Assert.Equal(19.925, result.Zones[2].TemperatureValue); Assert.Equal(new DateTime(2019, 5, 2, 9, 12, 43, DateTimeKind.Utc), result.Zones[2].TemperatureValueTime); Assert.Equal(20, result.Zones[2].NominalValue); Assert.Equal(new DateTime(2018, 12, 8, 18, 10, 44, DateTimeKind.Utc), result.Zones[2].NominalValueTime); Assert.Equal(93, result.Zones[2].ControlValue); Assert.Equal(new DateTime(2019, 5, 2, 9, 12, 53, DateTimeKind.Utc), result.Zones[2].ControlValueTime); }
public async Task GenerateUnitTestRequestUris() { var mockHttp = new MockDigitalstromConnection.TestGenerationHttpMessageHandler(); using var dsApiClient = new DigitalstromDssClient(mockHttp.AddAuthMock().ToTestGenerationProvider()); var UriForMethodName = new Dictionary <string, string>(); try { await dsApiClient.GetSensorValues(); } catch { } UriForMethodName.Add("GetSensorValues", mockHttp.LastCalledUri); try { await dsApiClient.GetStructure(); } catch { } UriForMethodName.Add("GetStructure", mockHttp.LastCalledUri); try { await dsApiClient.GetTemperatureControlStatus(); } catch { } UriForMethodName.Add("GetTemperatureControlStatus", mockHttp.LastCalledUri); try { await dsApiClient.GetTemperatureControlValues(); } catch { } UriForMethodName.Add("GetTemperatureControlValues", mockHttp.LastCalledUri); try { await dsApiClient.GetTemperatureControlConfig(); } catch { } UriForMethodName.Add("GetTemperatureControlConfig", mockHttp.LastCalledUri); try { await dsApiClient.SetTemperatureControlValues(zoneKitchen, null, null, 22); } catch { } UriForMethodName.Add("SetTemperatureControlValues", mockHttp.LastCalledUri); try { await dsApiClient.CallScene(zoneKitchen, Color.Yellow, SceneCommand.Preset1, true); } catch { } UriForMethodName.Add("CallScene", mockHttp.LastCalledUri); try { await dsApiClient.GetReachableScenes(zoneKitchen, Color.Yellow); } catch { } UriForMethodName.Add("GetReachableScenes", mockHttp.LastCalledUri); try { await dsApiClient.GetLastCalledScene(zoneKitchen, Color.Yellow); } catch { } UriForMethodName.Add("GetLastCalledScene", mockHttp.LastCalledUri); try { await dsApiClient.GetZonesAndLastCalledScenes(); } catch { } UriForMethodName.Add("GetZonesAndLastCalledScenes", mockHttp.LastCalledUri); try { await dsApiClient.GetDevicesAndOutputChannelTypes(); } catch { } UriForMethodName.Add("GetDevicesAndOutputChannelTypes", mockHttp.LastCalledUri); try { await dsApiClient.GetDevicesAndLastOutputValues(); } catch { } UriForMethodName.Add("GetDevicesAndLastOutputValues", mockHttp.LastCalledUri); try { await dsApiClient.GetZonesAndSensorValues(); } catch { } UriForMethodName.Add("GetZonesAndSensorValues", mockHttp.LastCalledUri); try { await dsApiClient.GetMeteringCircuits(); } catch { } UriForMethodName.Add("GetMeteringCircuits", mockHttp.LastCalledUri); try { await dsApiClient.GetCircuitZones(); } catch { } UriForMethodName.Add("GetCircuitZones", mockHttp.LastCalledUri); try { await dsApiClient.GetTotalEnergy(1, 600); } catch { } UriForMethodName.Add("GetTotalEnergy", mockHttp.LastCalledUri); try { await dsApiClient.GetEnergy(new Dsuid("99999942f800000000000f0000deadbeef"), 1, 600); } catch { } UriForMethodName.Add("GetEnergy", mockHttp.LastCalledUri); try { await dsApiClient.Subscribe((SystemEventName)SystemEvent.CallScene, 42); } catch { } UriForMethodName.Add("Subscribe", mockHttp.LastCalledUri); try { await dsApiClient.Unsubscribe((SystemEventName)SystemEvent.CallScene, 42); } catch { } UriForMethodName.Add("Unsubscribe", mockHttp.LastCalledUri); try { await dsApiClient.PollForEvents(42, 60000); } catch { } UriForMethodName.Add("PollForEvents", mockHttp.LastCalledUri); try { await dsApiClient.RaiseEvent((SystemEventName)SystemEvent.CallScene, new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("mykey", "myval") }); } catch { } UriForMethodName.Add("RaiseEvent", mockHttp.LastCalledUri); var allUris = string.Join("\n", UriForMethodName.Select(x => $"{x.Key}: {x.Value}")); }