Example #1
0
        public void Should_add_new_notification_position()
        {
            DISetup.SetupContainer();
            var dbMock  = GetDbMock();
            var newItem = new NotificationPositionType()
            {
                Position = Models.Common.NotificationPosition.TopLeft
            };
            var storage = new Storage(dbMock, new Mock <IMapper>().Object);

            storage.RegisterNotificationPosition(newItem);
            dbMock.NotificationPosition.Count.Should().Be(2);
            dbMock.NotificationPosition.FirstOrDefault(p => p.Position == newItem.Position).Should().NotBeNull();
        }
Example #2
0
        public void Should_add_and_return_added_notification_position()
        {
            DISetup.SetupContainer();
            var dbMock  = GetDbMock();
            var newItem = new NotificationPositionType()
            {
                Position = Models.Common.NotificationPosition.TopLeft
            };
            var mapper = new Mock <IMapper>();

            mapper.Setup(p => p.Map <List <INotificationPositionType> >(It.IsAny <IEnumerable <INotificationPositionType> >())).Returns(() =>
            {
                return(dbMock.NotificationPosition.ToList());
            });
            var storage = new Storage(dbMock, mapper.Object);

            storage.RegisterNotificationPosition(newItem);
            var result = storage.GetNotificationPositions();

            result.Count().Should().Be(2);
            result.FirstOrDefault(p => p.Position == newItem.Position).Should().NotBeNull();
        }