public void Create_BackgroundDataContainsConfiguredWMTSConfiguration_ReturnsBackgroundDataEntity() { // Setup const string name = "background"; const string sourceCapabilitiesUrl = "//url"; const string selectedCapabilityName = "selectedName"; const string preferredFormat = "image/png"; const bool isVisible = true; const bool isConfigured = true; var transparancy = (RoundedDouble)0.3; var configuration = new WmtsBackgroundDataConfiguration(isConfigured, sourceCapabilitiesUrl, selectedCapabilityName, preferredFormat); var backgroundData = new BackgroundData(configuration) { IsVisible = isVisible, Transparency = transparancy, Name = name }; // Call BackgroundDataEntity entity = backgroundData.Create(); // Assert Assert.AreEqual(name, entity.Name); Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible); Assert.AreEqual(transparancy, entity.Transparency); var expectedKeyValuePairs = new Dictionary <string, string> { { BackgroundDataIdentifiers.IsConfigured, Convert.ToByte(isConfigured).ToString() }, { BackgroundDataIdentifiers.SourceCapabilitiesUrl, sourceCapabilitiesUrl }, { BackgroundDataIdentifiers.SelectedCapabilityIdentifier, selectedCapabilityName }, { BackgroundDataIdentifiers.PreferredFormat, preferredFormat } }; IEnumerable <KeyValuePair <string, string> > actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select( metaEntity => new KeyValuePair <string, string>(metaEntity.Key, metaEntity.Value)); CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs); }
public void Create_BackgroundDataContainsWellKnownConfiguration_ReturnsBackgroundDataEntity() { // Setup var random = new Random(21); var wellKnownTileSource = random.NextEnumValue <RiskeerWellKnownTileSource>(); const string name = "background"; const bool isVisible = true; const BackgroundDataType backgroundDataType = BackgroundDataType.WellKnown; var transparancy = (RoundedDouble)0.3; var configuration = new WellKnownBackgroundDataConfiguration(wellKnownTileSource); var backgroundData = new BackgroundData(configuration) { IsVisible = isVisible, Transparency = transparancy, Name = name }; // Call BackgroundDataEntity entity = backgroundData.Create(); // Assert Assert.AreEqual(name, entity.Name); Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible); Assert.AreEqual(transparancy, entity.Transparency); Assert.AreEqual(Convert.ToByte(backgroundDataType), entity.BackgroundDataType); var expectedKeyValuePairs = new Dictionary <string, string> { { BackgroundDataIdentifiers.WellKnownTileSource, ((int)wellKnownTileSource).ToString() } }; IEnumerable <KeyValuePair <string, string> > actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select( metaEntity => new KeyValuePair <string, string>(metaEntity.Key, metaEntity.Value)); CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs); }
public void Create_BackgroundDataContainsUnconfiguredWMTSConfiguration_ReturnsBackgroundDataEntity() { // Setup const string name = "background"; const bool isVisible = true; const bool isConfigured = false; var transparancy = (RoundedDouble)0.3; var configuration = new WmtsBackgroundDataConfiguration(); var backgroundData = new BackgroundData(configuration) { IsVisible = isVisible, Transparency = transparancy, Name = name }; // Call BackgroundDataEntity entity = backgroundData.Create(); // Assert Assert.AreEqual(name, entity.Name); Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible); Assert.AreEqual(transparancy, entity.Transparency); var expectedKeyValuePairs = new Dictionary <string, string> { { BackgroundDataIdentifiers.IsConfigured, Convert.ToByte(isConfigured).ToString() } }; IEnumerable <KeyValuePair <string, string> > actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select( metaEntity => new KeyValuePair <string, string>(metaEntity.Key, metaEntity.Value)); CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs); }