public void ensureNameCantBeChangedToNull() { CustomizedProductCollection instance = new CustomizedProductCollection("Peach"); Assert.Throws <ArgumentException>(() => instance.changeName(null)); }
public void ensureNameCantBeChangedToEmptyString() { CustomizedProductCollection instance = new CustomizedProductCollection("Shroom"); Assert.Throws <ArgumentException>(() => instance.changeName("")); }
/// <summary> /// Updates a customized product collection's basic information /// </summary> /// <param name="modelView">model view with the updates for a customized product collection</param> /// <returns>Updated customized product collection or throws an exception if an error occurs</returns> public static CustomizedProductCollection update(UpdateCustomizedProductCollectionModelView modelView) { CustomizedProductCollectionRepository customizedProductCollectionRepository = PersistenceContext.repositories() .createCustomizedProductCollectionRepository(); CustomizedProductCollection customizedProductCollection = customizedProductCollectionRepository.find(modelView.customizedProductCollectionId); checkIfCustomizedProductCollectionWasFound( customizedProductCollection, modelView.customizedProductCollectionId ); customizedProductCollection.changeName(modelView.name); CustomizedProductCollection updatedCustomizedProductCollection = customizedProductCollectionRepository.update(customizedProductCollection); checkIfUpdatedCustomizedProductCollectionWasSaved( updatedCustomizedProductCollection, modelView.customizedProductCollectionId ); return(updatedCustomizedProductCollection); }
public void ensureNameCanBeChangedToValidNewName() { var oldName = "Luigi"; var newName = "Mario"; CustomizedProductCollection instance = new CustomizedProductCollection(oldName); instance.changeName(newName); Assert.NotEqual(oldName, instance.name); }