private static WatchType SetupProduct(string watchName, string identifierPrefix, short revision = 5) { var watchface = new WatchfaceType { Name = "Black water resistant for " + watchName, Identity = new ProductIdentity(identifierPrefix + "4711", revision), Numbers = new[] { 3, 6, 9, 12 } }; var needles = new List <NeedlePartLink> { new NeedlePartLink { Product = new NeedleType { Name = "Hours needle", Identity = new ProductIdentity(identifierPrefix + "24", 1) } }, new NeedlePartLink { Product = new NeedleType { Name = "Minutes needle", Identity = new ProductIdentity(identifierPrefix + "1440", 2) } }, new NeedlePartLink { Product = new NeedleType { Name = "Seconds needle", Identity = new ProductIdentity(identifierPrefix + "B86400", 3) } } }; var watch = new WatchType { Name = watchName, Identity = new ProductIdentity(identifierPrefix + WatchMaterial, revision), Watchface = new ProductPartLink <WatchfaceType> { Product = watchface }, Needles = needles, Weight = 123.45 }; return(watch); }
public void LoadAndSaveTypeWithNullPropertyMapper() { // Arrange var watchfaceWithString = new WatchfaceType { Name = "Fasel", Identity = new ProductIdentity("55889966", 1), Numbers = new[] { 3, 6, 9, 12 }, Brand = "Unknown", Color = 42 //That's important for this test }; // Act var savedId = _storage.SaveType(watchfaceWithString); var loaded = (WatchfaceType)_storage.LoadType(savedId); // Assert Assert.AreEqual(0, loaded.Color); }
public void LoadAndSaveTypeWithNullString() { // Arrange var watchfaceWithString = new WatchfaceType { Name = "Blubber", Identity = new ProductIdentity("8899665", 1), Numbers = new[] { 3, 6, 9, 12 }, Brand = null //That's important for this test }; var savedId = _storage.SaveType(watchfaceWithString); var loaded = (WatchfaceType)_storage.LoadType(savedId); // Act & Assert Assert.DoesNotThrow(delegate { _storage.SaveType(loaded); }, "Save should not fail with null string property"); }