public void Read_WmtsConfigurationIsConfiguredFalse_NoParametersAdded() { // Setup const bool isConfigured = false; var entity = new BackgroundDataEntity { BackgroundDataMetaEntities = new List <BackgroundDataMetaEntity> { new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.IsConfigured, Value = Convert.ToByte(isConfigured).ToString() }, new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.SourceCapabilitiesUrl, Value = "//url" }, new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.SelectedCapabilityIdentifier, Value = "capability name" }, new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.PreferredFormat, Value = "image/jpeg" } }, BackgroundDataType = Convert.ToByte(BackgroundDataType.Wmts) }; // Call BackgroundData backgroundData = entity.Read(); // Assert var configuration = (WmtsBackgroundDataConfiguration)backgroundData.Configuration; Assert.AreEqual(false, configuration.IsConfigured); Assert.IsNull(configuration.SourceCapabilitiesUrl); Assert.IsNull(configuration.SelectedCapabilityIdentifier); Assert.IsNull(configuration.PreferredFormat); }
public void Read_EntityWithWellKnownData_ReturnBackgroundData() { // Setup const string name = "map data"; const bool isVisible = false; const double transparancy = 0.4; const BackgroundDataType backgroundDataType = BackgroundDataType.WellKnown; var random = new Random(21); var wellKnownTileSource = random.NextEnumValue <RiskeerWellKnownTileSource>(); var entity = new BackgroundDataEntity { Name = name, BackgroundDataMetaEntities = new List <BackgroundDataMetaEntity> { new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.WellKnownTileSource, Value = ((int)wellKnownTileSource).ToString() } }, IsVisible = Convert.ToByte(isVisible), Transparency = transparancy, BackgroundDataType = Convert.ToByte(backgroundDataType) }; // Call BackgroundData backgroundData = entity.Read(); // Assert Assert.AreEqual(isVisible, backgroundData.IsVisible); Assert.AreEqual(transparancy, backgroundData.Transparency.Value); Assert.AreEqual(name, backgroundData.Name); Assert.IsNotNull(backgroundData.Configuration); var configuration = (WellKnownBackgroundDataConfiguration)backgroundData.Configuration; Assert.AreEqual(wellKnownTileSource, configuration.WellKnownTileSource); }
public void Read_EntityWithWmtsData_ReturnBackgroundData() { // Setup const string name = "map data"; const string url = "//url"; const string capabilityName = "capability name"; const string preferredFormat = "image/jpeg"; const bool isVisible = false; const double transparancy = 0.4; const bool isConfigured = true; const BackgroundDataType backgroundDataType = BackgroundDataType.Wmts; var backgroundDataMetaEntities = new[] { new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.IsConfigured, Value = Convert.ToByte(isConfigured).ToString() }, new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.SourceCapabilitiesUrl, Value = url }, new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.SelectedCapabilityIdentifier, Value = capabilityName }, new BackgroundDataMetaEntity { Key = BackgroundDataIdentifiers.PreferredFormat, Value = preferredFormat } }; var entity = new BackgroundDataEntity { Name = name, BackgroundDataMetaEntities = backgroundDataMetaEntities, IsVisible = Convert.ToByte(isVisible), Transparency = transparancy, BackgroundDataType = Convert.ToByte(backgroundDataType) }; // Call BackgroundData backgroundData = entity.Read(); // Assert Assert.AreEqual(isVisible, backgroundData.IsVisible); Assert.AreEqual(transparancy, backgroundData.Transparency.Value); Assert.AreEqual(name, backgroundData.Name); Assert.IsNotNull(backgroundData.Configuration); var configuration = (WmtsBackgroundDataConfiguration)backgroundData.Configuration; Assert.AreEqual(isConfigured, configuration.IsConfigured); Assert.AreEqual(url, configuration.SourceCapabilitiesUrl); Assert.AreEqual(capabilityName, configuration.SelectedCapabilityIdentifier); Assert.AreEqual(preferredFormat, configuration.PreferredFormat); }