public void FailSavePromotionCatalogTest() { try { var dict = new Dictionary <Guid, IPromotion>(); var dataContext = new JSonFileDataContext("", knownTypes); dataContext.SaveData(dict); Assert.Fail("File Path is invalid"); } catch (Exception ex) { Assert.IsTrue(ex != null); } }
public void PassPromotionCatalogInitTest() { try { CreatePromotionCatalogFile(CreatePromotionCatalog()); var dataContext = new JSonFileDataContext(promotionCatalogPath, knownTypes); var promotionCatalog = new PromotionCatalog(dataContext); promotionCatalog.LoadCatalog(); Assert.IsNotNull(promotionCatalog); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void ReadEmptyPromotionCatalogTest() { try { var writeDict = new Dictionary <Guid, IPromotion>(); CreatePromotionCatalogFile(writeDict); Assert.IsTrue(File.Exists(promotionCatalogPath)); var dataContext = new JSonFileDataContext(promotionCatalogPath, knownTypes); var readDict = dataContext.LoadData <IDictionary <Guid, IPromotion> >(); Assert.IsNotNull(readDict); Assert.AreEqual(readDict.Count, 0); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void PassPromtionCatalogLoadFullTest() { try { var virtualCatalog = CreatePromotionCatalog(); CreatePromotionCatalogFile(virtualCatalog); var dataContext = new JSonFileDataContext(promotionCatalogPath, knownTypes); var promotionCatalog = new PromotionCatalog(dataContext); foreach (var key in virtualCatalog.Keys) { Assert.IsNotNull(promotionCatalog.ItemExists(key)); } } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void PassPromotionCatalogSaveFullTest() { try { var virtualCatalog = CreatePromotionCatalog(); CreatePromotionCatalogFile(virtualCatalog); var dataContext = new JSonFileDataContext(promotionCatalogPath, knownTypes); var promotionCatalog = new PromotionCatalog(dataContext); File.Delete(promotionCatalogPath); Assert.IsTrue(!File.Exists(promotionCatalogPath)); promotionCatalog.SaveCatalog(virtualCatalog); Assert.IsTrue(File.Exists(promotionCatalogPath)); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
void CreatePromotionCatalogFile(IDictionary <Guid, IPromotion> dict) { var dataContext = new JSonFileDataContext(promotionCatalogPath, knownTypes); dataContext.SaveData(dict); }