public void GetValue_WhenAssignedGuidExistsInModel_ReturnsGuid() { var initialToken = Guid.Parse("de7d7fcb-ccd0-46d2-b3e2-cd4a357c697f"); var concTokenProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithGuidMember>("ConcurrencyToken"); var accessor = new ConcurrencyTokenAccessor(concTokenProperty); var model = new ModelWithGuidMember {ConcurrencyToken = initialToken}; var token = accessor.GetValue(model); Assert.AreEqual(initialToken, token); }
public void SetValue_WhenAssigningNewGuidOnModel_UpdatesGuidOnModel() { var initialToken = Guid.Parse("de7d7fcb-ccd0-46d2-b3e2-cd4a357c697f"); var assignedToken = Guid.Parse("f13185dd-1145-4e63-a53f-a0e22dda3e03"); var concTokenProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithGuidMember>("ConcurrencyToken"); var accessor = new ConcurrencyTokenAccessor(concTokenProperty); var model = new ModelWithGuidMember { ConcurrencyToken = initialToken }; accessor.SetValue(model, assignedToken); Assert.AreEqual(assignedToken, model.ConcurrencyToken); }
public void GetValue_WhenAssignedGuidExistsInModel_ReturnsGuid() { var initialToken = Guid.Parse("de7d7fcb-ccd0-46d2-b3e2-cd4a357c697f"); var concTokenProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithGuidMember>("ConcurrencyToken"); var accessor = new ConcurrencyTokenAccessor(concTokenProperty); var model = new ModelWithGuidMember { ConcurrencyToken = initialToken }; var token = accessor.GetValue(model); Assert.AreEqual(initialToken, token); }
public void SetValue_WhenAssigningNewGuidOnModel_UpdatesGuidOnModel() { var initialToken = Guid.Parse("de7d7fcb-ccd0-46d2-b3e2-cd4a357c697f"); var assignedToken = Guid.Parse("f13185dd-1145-4e63-a53f-a0e22dda3e03"); var concTokenProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithGuidMember>("ConcurrencyToken"); var accessor = new ConcurrencyTokenAccessor(concTokenProperty); var model = new ModelWithGuidMember { ConcurrencyToken = initialToken }; accessor.SetValue(model, assignedToken); Assert.AreEqual(assignedToken, model.ConcurrencyToken); }