예제 #1
0
        public async Task GetModelsMultipleDtmisWithDepsFromExtendsVariant()
        {
            const string dtmi1        = "dtmi:com:example:TemperatureController;1";
            const string dtmi2        = "dtmi:com:example:ColdStorage;1";
            const string expectedDeps = "dtmi:com:example:Thermostat;1," +
                                        "dtmi:azure:DeviceManagement:DeviceInformation;1," +
                                        "dtmi:com:example:Room;1," +
                                        "dtmi:com:example:Freezer;1";

            ModelsRepositoryClient       client = GetClient(ModelsRepositoryTestBase.ClientType.Local);
            IDictionary <string, string> result = await client.GetModelsAsync(new[] { dtmi1, dtmi2 });

            var expectedDtmis = $"{dtmi1},{dtmi2},{expectedDeps}".Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);

            result.Keys.Count.Should().Be(expectedDtmis.Length);

            foreach (var id in expectedDtmis)
            {
                result.Should().ContainKey(id);
                ModelsRepositoryTestBase.ParseRootDtmiFromJson(result[id]).Should().Be(id);
            }
        }