public void ShouldUpdateAnExistingBrandDocument() { // First add a brand document var initialBrand = BrandInjector.Inject(_mapCfg); RavenRepo repo = new RavenRepo("http://localhost:8080", _mapCfg); var freshBrand = repo.GetBrand(initialBrand.Id); Assert.AreEqual(initialBrand.Id, freshBrand.Id); freshBrand.BrandName = "updated"; Assert.AreNotEqual(initialBrand.BrandName, freshBrand.BrandName); repo.SaveBrand(freshBrand); var freshFreshBrand = repo.GetBrand(freshBrand.Id); Assert.AreEqual(freshBrand.Id, freshFreshBrand.Id); Assert.AreEqual(freshBrand.BrandName, freshFreshBrand.BrandName); }
public static Brand Inject(MapperConfiguration cfg) { RavenRepo repo = new RavenRepo("http://localhost:8080", cfg); var guid = Guid.NewGuid().ToString(); var brand = new Brand { BrandName = "Name " + guid, BrandCode = "Code " + guid, BrandDescription = "Descr " + guid, BrandDisplayName = "Display " + guid, InCommBrandIdentifier = "Brand id " + guid, BrandImageUrl = "ImageUrl " + guid, IsActive = true, CreatedOn = DateTime.Now, CreatedBy = "CreatedByFoo", ModifiedOn = DateTime.Now, ModifiedBy = "ModifiedByFoo" }; repo.SaveBrand(brand); return brand; }