public void NotificationConverter_CanConvertMessage_IsTrue()
        {
            var converter  = new NotificationConverter();
            var canConvert = converter.CanConvert(new Message().GetType());

            Assert.IsTrue(canConvert);
        }
        public void NotificationConverter_ReadJsonCommentNotification_Equal()
        {
            var converter = new NotificationConverter();
            var reader    =
                new JsonTextReader(new StringReader(MockAccountEndpointResponses.GetCommentNotification));

            reader.Read();
            var serializer = new JsonSerializer();

            var actual =
                (CommentNotification)converter.ReadJson(reader, typeof(CommentNotification), null, serializer);

            Assert.NotNull(actual);

            Assert.Equal(null, actual.AlbumCover);
            Assert.Equal("jasdev", actual.Author);
            Assert.Equal(3698510, actual.AuthorId);
            Assert.Equal(0, actual.Children.Count());
            Assert.Equal("Reply test", actual.CommentText);
            Assert.Equal(new DateTimeOffset(new DateTime(2014, 07, 22, 23, 12, 54, DateTimeKind.Utc)),
                         actual.DateTime);
            Assert.Equal(false, actual.Deleted);
            Assert.Equal(0, actual.Downs);
            Assert.Equal("VK9VqcM", actual.ImageId);
            Assert.Equal(false, actual.OnAlbum);
            Assert.Equal(3615, actual.ParentId);
            Assert.Equal(1, actual.Points);
            Assert.Equal(1, actual.Ups);
            Assert.Equal(3616, actual.Id);
        }
        public void NotificationConverter_CanConvertComment_IsTrue()
        {
            var converter  = new NotificationConverter();
            var canConvert = converter.CanConvert(new Comment().GetType());

            Assert.IsTrue(canConvert);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void accept(final org.neo4j.bolt.runtime.BoltResult_Visitor visitor) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public override void Accept(Org.Neo4j.Bolt.runtime.BoltResult_Visitor visitor)
        {
            long start = _clock.millis();

            @delegate.Accept(row =>
            {
                visitor.Visit(row);
                return(true);
            });
            AddRecordStreamingTime(visitor, _clock.millis() - start);
            QueryExecutionType qt = @delegate.ExecutionType();

            visitor.AddMetadata("type", Values.stringValue(QueryTypeCode(qt.QueryType())));

            if (@delegate.QueryStatistics().containsUpdates())
            {
                MapValue stats = QueryStats(@delegate.QueryStatistics());
                visitor.AddMetadata("stats", stats);
            }
            if (qt.RequestedExecutionPlanDescription())
            {
                ExecutionPlanDescription rootPlanTreeNode = @delegate.ExecutionPlanDescription();
                string metadataFieldName = rootPlanTreeNode.HasProfilerStatistics() ? "profile" : "plan";
                visitor.AddMetadata(metadataFieldName, ExecutionPlanConverter.Convert(rootPlanTreeNode));
            }

            IEnumerable <Notification> notifications = @delegate.Notifications;

            if (notifications.GetEnumerator().hasNext())
            {
                visitor.AddMetadata("notifications", NotificationConverter.Convert(notifications));
            }
        }
Exemplo n.º 5
0
 public MyGesture(VVVVGesture vvvvK)
 {
     subscription = vvvvK.Notifications.Subscribe(notification => {
         var mn = NotificationConverter.ConvertNotification(notification, DummyNotificationSpaceTransformer.Instance) as GestureNotification;
         if (mn != null)
         {
             m.OnNext(mn);
         }
     });
 }
Exemplo n.º 6
0
 /// <summary>
 /// Get list of notification.
 /// </summary>
 /// <param name="userId">UseId</param>
 /// <returns>Returns list of notification.</returns>
 public List <Notification> GetNotification(int userId)
 {
     return(NotificationConverter.ConvertListFromCore(UnitOfWork.NotificationRepository.Find(x => x.UserNotificationMappings.Any(y => !y.Seen &&
                                                                                                                                 y.UserId == userId))
                                                      .ToList())
            .GroupBy(x => x.Link)
            .Select(grp => grp.First())
            .OrderBy(x => x.NotificationId)
            .ToList());
 }
Exemplo n.º 7
0
 public MyKeyboard(VVVVKeyboard vvvvK)
 {
     VVVVK        = vvvvK;
     subscription = vvvvK.KeyNotifications.Subscribe(notification => {
         var mn = NotificationConverter.ConvertNotification(notification, DummyNotificationSpaceTransformer.Instance) as KeyNotification;
         if (mn != null)
         {
             m.OnNext(mn);
         }
     });
 }
Exemplo n.º 8
0
 public MyMouse(VVVVMouse vvvvM)
 {
     VVVVM        = vvvvM;
     subscription = vvvvM.MouseNotifications.Subscribe(notification => {
         var mn = NotificationConverter.ConvertNotification(notification, DummyNotificationSpaceTransformer.Instance) as MouseNotification;
         if (mn != null)
         {
             m.OnNext(mn);
         }
     });
 }
Exemplo n.º 9
0
        /// <summary>
        /// Add notification for a list of users.
        /// </summary>
        /// <param name="notification">Notification class onject</param>
        /// <param name="listUserId">List of userId</param>
        /// <returns>Returns true if Notification is added successfully else false.</returns>
        internal bool AddNotification(Notification notification, List <int> listUserId)
        {
            DAL.EntityFramework.Notification coreNotification = NotificationConverter.ConvertToCore(notification);

            foreach (var userId in listUserId)
            {
                coreNotification.UserNotificationMappings.Add(new UserNotificationMapping
                {
                    Seen   = false,
                    UserId = userId
                });
            }
            UnitOfWork.NotificationRepository.Add(coreNotification);
            return(UnitOfWork.Commit() > 0);
        }
Exemplo n.º 10
0
        static Program()
        {
            Scope                 = CompositionRoot.GetBuilder.BeginLifetimeScope();
            Dispatcher            = new Dispatcher();
            NotificationConverter = new NotificationConverter();
            //  Services
            NotificacionBoardService = Scope.Resolve <INotificationBoardService>();
            NotificacionService      = Scope.Resolve <INotificationService>();

            GoalDebtService      = Scope.Resolve <IGoalService <Debt> >();
            GoalSavingService    = Scope.Resolve <IGoalService <Saving> >();
            GoalRecurrentService = Scope.Resolve <IGoalService <Recurrent> >();

            UserService = Scope.Resolve <IUserService>();
        }
        public void NotificationConverter_ReadJsonMessageNotification_AreEqual()
        {
            var converter = new NotificationConverter();
            var reader    =
                new JsonTextReader(new StringReader(AccountEndpointResponses.GetMessageNotification));

            reader.Read();
            var serializer = new JsonSerializer();

            var actual = (Message)converter.ReadJson(reader, typeof(Message), null, serializer);

            Assert.IsNotNull(actual);

            Assert.AreEqual(76767, actual.Id);
            Assert.AreEqual("Bob", actual.From);
            Assert.AreEqual(89898, actual.AccountId);
            Assert.AreEqual(3434, actual.WithAccountId);
            Assert.AreEqual("Test33", actual.LastMessage);
            Assert.AreEqual(2, actual.MessageNum);
            Assert.AreEqual(new DateTimeOffset(new DateTime(2015, 10, 12, 02, 31, 43, DateTimeKind.Utc)),
                            actual.DateTime);
        }
Exemplo n.º 12
0
        public void CanConvert(Type type, bool canConvert)
        {
            var converter = new NotificationConverter();

            Assert.Equal(converter.CanConvert(type), canConvert);
        }