Beispiel #1
0
        public void UpdatePackagingInfoReplacesItems()
        {
            var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery,
                                                           UKCompetentAuthority.England, 0);

            var packagingInfos = new List <PackagingInfo>
            {
                PackagingInfo.CreateOtherPackagingInfo("package description"),
                PackagingInfo.CreatePackagingInfo(PackagingType.Bag)
            };

            var newPackagingInfos = new List <PackagingInfo>
            {
                PackagingInfo.CreatePackagingInfo(PackagingType.Box),
                PackagingInfo.CreatePackagingInfo(PackagingType.Bulk)
            };

            notification.SetPackagingInfo(packagingInfos);

            notification.SetPackagingInfo(newPackagingInfos);

            Assert.Collection(notification.PackagingInfos,
                              item => Assert.Equal(notification.PackagingInfos.ElementAt(0).PackagingType, PackagingType.Box),
                              item => Assert.Equal(notification.PackagingInfos.ElementAt(1).PackagingType, PackagingType.Bulk));
        }
Beispiel #2
0
        public void CantSetOtherDescriptionToEmptyString()
        {
            Action createPackagingInfo =
                () => PackagingInfo.CreateOtherPackagingInfo(string.Empty);

            Assert.Throws <ArgumentException>(createPackagingInfo);
        }
Beispiel #3
0
        public void CantSetOtherDescriptionToNull()
        {
            Action createPackagingInfo =
                () => PackagingInfo.CreateOtherPackagingInfo(null);

            Assert.Throws <ArgumentNullException>(createPackagingInfo);
        }
Beispiel #4
0
        public void CanAddPackagingInfo()
        {
            var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery,
                                                           UKCompetentAuthority.England, 0);

            notification.SetPackagingInfo(new[] { PackagingInfo.CreateOtherPackagingInfo("package description") });

            Assert.Equal(1, notification.PackagingInfos.Count());
        }