Exemple #1
0
        public void ensureNameCantBeChangedToNull()
        {
            CustomizedProductCollection instance =
                new CustomizedProductCollection("Peach");

            Assert.Throws <ArgumentException>(() => instance.changeName(null));
        }
Exemple #2
0
        public void ensureNameCantBeChangedToEmptyString()
        {
            CustomizedProductCollection instance =
                new CustomizedProductCollection("Shroom");

            Assert.Throws <ArgumentException>(() => instance.changeName(""));
        }
Exemple #3
0
        /// <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);
        }
Exemple #4
0
        public void ensureNameCanBeChangedToValidNewName()
        {
            var oldName = "Luigi";
            var newName = "Mario";
            CustomizedProductCollection instance =
                new CustomizedProductCollection(oldName);

            instance.changeName(newName);

            Assert.NotEqual(oldName, instance.name);
        }