Example #1
0
        public ActionResult ImportSiteOBoobs()
        {
            string baseApiUrl = "http://api.oboobs.ru";

            string        UrlRequest = baseApiUrl + "/boobs/count/";
            CountResponse response   = MakeRequest <CountResponse>(UrlRequest)[0];
            List <Image>  list       = new List <Image>();
            Random        rnd        = new Random();
            int           begin      = rnd.Next(1, 10000);

            for (int i = begin; i < begin + 10; ++i)
            {
                UrlRequest = baseApiUrl + "/boobs/get/" + i.ToString() + "/";

                ImageResponse[] imageResponse = MakeRequest <ImageResponse>(UrlRequest);
                if (imageResponse.Length > 0)
                {
                    Image uploadedImage = new Image
                    {
                        PhotoUrl = "http://media.oboobs.ru/" + imageResponse[0].PreviewUrl,
                        UserId   = GetUserId(User.Identity.Name)
                    };

                    list.Add(uploadedImage);
                }
            }

            return(View(list));
        }
Example #2
0
        /// <summary>
        /// Получить количество записей в seq по заданным условиям
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <CountResponse> GetCountOfLogs(LogsRequest request)
        {
            CountResponse response = new CountResponse();

            _seqConnection = new SeqConnection(_configuration["SeqUrl"], "autxb7drQIW5afVHz4Nz");

            if (!_seqConnection.EnsureConnectedAsync(new TimeSpan(100)).IsCompleted)
            {
                _seqConnection = new SeqConnection(_configuration["SeqUrl"], "autxb7drQIW5afVHz4Nz");
            }
            List <LogsRequest> logs = new List <LogsRequest>();
            //var installedApps = _seqConnection.Apps.ListAsync();

            //string login = request.Login;
            //string reqPath = request.RequestPath;

            //var resultSet = await _seqConnection.Events.ListAsync(
            //    filter: $"login = '******' AND RequestPath = '{reqPath}'",
            //    render: true,
            //    fromDateUtc: request.BeginDate,
            //    toDateUtc: request.EndDate,
            //    count: 100) ;

            //все записи в базе по указанным фильтрам
            string login           = request.Login ?? "noLogin";
            string reqPath         = request.RequestPath ?? "";
            string lastReadEventId = null;

            while (true)
            {
                var resultSetFull = await _seqConnection.Events.InSignalAsync(
                    filter : $"login = '******' AND RequestPath = '{reqPath}'",
                    render : true,
                    fromDateUtc : request.BeginDate,
                    toDateUtc : request.EndDate,
                    afterId : lastReadEventId,
                    count : 100000);

                //foreach (var evt in resultSetFull.Events)
                //    logs.Add(new LogRequest() { TimeStamp = Convert.ToDateTime(evt.Timestamp), Message = evt.RenderedMessage });
                response.Count += resultSetFull.Events.Count();

                if (resultSetFull.Statistics.Status != ResultSetStatus.Partial)
                {
                    break;
                }

                lastReadEventId = resultSetFull.Statistics.LastReadEventId;
            }

            //foreach (var evt in resultSet)
            //{
            //    //можно сделать фильтр по уровню ошибки
            //    //if (evt.Level == "Error")
            //    logs.Add(new LogRequest() { TimeStamp = Convert.ToDateTime(evt.Timestamp), Message = evt.RenderedMessage });
            //}


            return(response);
        }
Example #3
0
    void AtualizaqtdPlayersPlayersParaTodos(int somar)
    {
        qtdPlayers += somar;

        var countResponse = CountResponse.Create();

        countResponse.count = qtdPlayers;
        countResponse.Send();
    }
Example #4
0
        public void Handle_ReturnsNumberOfElementInStorage()
        {
            // arrange
            var request   = new CountRequest();
            var processor = new CountProcessor();
            int count     = 5;
            var storage   = Substitute.For <IStorage>();

            storage.Count.Returns(count);

            // act
            CountResponse response = processor.Reply(request, storage);

            // assert
            Assert.Equal(count, response.Count);
        }
Example #5
0
        public async Task <IHttpActionResult> GetPendingUsersCount()
        {
            string className  = "MyPendingUsersController";
            string methodName = "GetPendingUsersCount";

            this.LogControllerStart(this.log, className, methodName);

            long?count = await this.relationshipsManager.ReadPendingUsersCount(this.UserHandle, this.AppHandle);

            var countResponse = new CountResponse()
            {
                Count = count.HasValue ? count.Value : 0
            };

            string logEntry = $"CountPendingUsers = {count}";

            this.LogControllerEnd(this.log, className, methodName, logEntry);
            return(this.Ok(countResponse));
        }
Example #6
0
        public async Task <CountResponse> GetDiasUserActivity(DiasUserActivityRequest request)
        {
            CountResponse countResponse = new CountResponse()
            {
                Count = 0
            };
            LogsRequest logsRequest = new LogsRequest()
            {
                AppName     = "DIAS",
                BeginDate   = request.BeginDate,
                EndDate     = request.EndDate,
                Login       = request.Login,
                RequestPath = "/api/data/GetComponentsByRole"
            };

            countResponse = await _logService.GetCountOfLogs(logsRequest);

            return(countResponse);
        }
Example #7
0
        public async Task <CountResponse> StrictQuery(string query, DateTime from, DateTime to)
        {
            CountResponse response = new CountResponse();

            _seqConnection = new SeqConnection(_configuration["SeqUrl"], "autxb7drQIW5afVHz4Nz");

            if (!_seqConnection.EnsureConnectedAsync(new TimeSpan(100)).IsCompleted)
            {
                _seqConnection = new SeqConnection(_configuration["SeqUrl"], "autxb7drQIW5afVHz4Nz");
            }

            List <LogsRequest> logs = new List <LogsRequest>();


            //все записи в базе по указанным фильтрам
            string lastReadEventId = null;

            while (true)
            {
                var resultSetFull = await _seqConnection.Events.InSignalAsync(
                    filter : query,
                    render : true,
                    fromDateUtc : from,
                    toDateUtc : to,
                    afterId : lastReadEventId,
                    count : 100000);

                response.Count += resultSetFull.Events.Count();

                if (resultSetFull.Statistics.Status != ResultSetStatus.Partial)
                {
                    break;
                }

                lastReadEventId = resultSetFull.Statistics.LastReadEventId;
            }

            return(response);
        }
        public async Task<CountResponse> Count()
        {
            // Get the list of representative service partition clients.
            IList<ServicePartitionClient<CommunicationClient>> partitionClients = 
                await this.GetServicePartitionClientsAsync();

            // For each partition client, keep track of partition information and the number of words
            ConcurrentDictionary<Int64RangePartitionInformation, long> totals = new ConcurrentDictionary<Int64RangePartitionInformation, long>();
            IList<Task> tasks = new List<Task>(partitionClients.Count);
            foreach (ServicePartitionClient<CommunicationClient> partitionClient in partitionClients)
            {
                // partitionClient internally resolves the address and retries on transient errors based on the configured retry policy.
                tasks.Add(
                    partitionClient.InvokeWithRetryAsync(
                        client =>
                        {
                            Uri serviceAddress = new Uri(client.BaseAddress, "Count");

                            HttpWebRequest request = WebRequest.CreateHttp(serviceAddress);
                            request.Method = "GET";
                            request.Timeout = (int)client.OperationTimeout.TotalMilliseconds;
                            request.ReadWriteTimeout = (int)client.ReadWriteTimeout.TotalMilliseconds;

                            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                            {
                                totals[client.ResolvedServicePartition.Info as Int64RangePartitionInformation] = Int64.Parse(reader.ReadToEnd().Trim());
                            }

                            return Task.FromResult(true);
                        }));
            }

            try
            {
                await Task.WhenAll(tasks);
            }
            catch (Exception ex)
            {
                // Sample code: print exception
                ServiceEventSource.Current.OperationFailed(ex.Message, "Count - run web request");
            }

            var retVal = new CountResponse();

            retVal.Total = totals.Aggregate<KeyValuePair<Int64RangePartitionInformation, long>, long>(0, (total, next) => next.Value + total);
            foreach (KeyValuePair<Int64RangePartitionInformation, long> partitionData in totals.OrderBy(partitionData => partitionData.Key.LowKey))
            {
                var info = new Info();

                info.Id = partitionData.Key.Id;
                info.LowKey = partitionData.Key.LowKey;
                info.HighKey = partitionData.Key.HighKey;
                info.Hits = partitionData.Value;

                retVal.Infos.Add(info);
            }

            return retVal;
        }
Example #9
0
 public override void OnEvent(CountResponse evnt)
 {
     counterText.text = evnt.count + "";
 }
        public async Task <CountResponse> Count()
        {
            // Get the list of representative service partition clients.
            IList <ServicePartitionClient <CommunicationClient> > partitionClients =
                await this.GetServicePartitionClientsAsync();

            // For each partition client, keep track of partition information and the number of words
            ConcurrentDictionary <Int64RangePartitionInformation, long> totals = new ConcurrentDictionary <Int64RangePartitionInformation, long>();
            IList <Task> tasks = new List <Task>(partitionClients.Count);

            foreach (ServicePartitionClient <CommunicationClient> partitionClient in partitionClients)
            {
                // partitionClient internally resolves the address and retries on transient errors based on the configured retry policy.
                tasks.Add(
                    partitionClient.InvokeWithRetryAsync(
                        client =>
                {
                    Uri serviceAddress = new Uri(client.BaseAddress, "Count");

                    HttpWebRequest request   = WebRequest.CreateHttp(serviceAddress);
                    request.Method           = "GET";
                    request.Timeout          = (int)client.OperationTimeout.TotalMilliseconds;
                    request.ReadWriteTimeout = (int)client.ReadWriteTimeout.TotalMilliseconds;

                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                        using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                        {
                            totals[client.ResolvedServicePartition.Info as Int64RangePartitionInformation] = Int64.Parse(reader.ReadToEnd().Trim());
                        }

                    return(Task.FromResult(true));
                }));
            }

            try
            {
                await Task.WhenAll(tasks);
            }
            catch (Exception ex)
            {
                // Sample code: print exception
                ServiceEventSource.Current.OperationFailed(ex.Message, "Count - run web request");
            }

            var retVal = new CountResponse();

            retVal.Total = totals.Aggregate <KeyValuePair <Int64RangePartitionInformation, long>, long>(0, (total, next) => next.Value + total);
            foreach (KeyValuePair <Int64RangePartitionInformation, long> partitionData in totals.OrderBy(partitionData => partitionData.Key.LowKey))
            {
                var info = new Info();

                info.Id      = partitionData.Key.Id;
                info.LowKey  = partitionData.Key.LowKey;
                info.HighKey = partitionData.Key.HighKey;
                info.Hits    = partitionData.Value;

                retVal.Infos.Add(info);
            }

            return(retVal);
        }
        public async Task SocialFollowPrivateUserRejectTest()
        {
            // create a client
            SocialPlusClient client = new SocialPlusClient(TestConstants.ServerApiBaseUrl);

            // create user1 and user2
            var postUserResponse1 = await TestUtilities.PostGenericUser(client);

            var postUserResponse2 = await TestUtilities.PostGenericUser(client);

            string auth1 = AuthHelper.CreateSocialPlusAuth(postUserResponse1.SessionToken);
            string auth2 = AuthHelper.CreateSocialPlusAuth(postUserResponse2.SessionToken);

            // user1 gets the profile of user2
            // user2 gets the profile of user1
            var userProfile1 = await client.Users.GetUserAsync(postUserResponse2.UserHandle, auth1);

            var userProfile2 = await client.Users.GetUserAsync(postUserResponse1.UserHandle, auth2);

            // make user2 a private user
            PutUserVisibilityRequest putUserVisibilityRequest = new PutUserVisibilityRequest(Visibility.Private);
            await client.Users.PutUserVisibilityAsync(putUserVisibilityRequest, auth2);

            // user1 requests to follow user2
            PostFollowingUserRequest postFollowingRequest = new PostFollowingUserRequest(postUserResponse2.UserHandle);
            await client.MyFollowing.PostFollowingUserAsync(postFollowingRequest, auth1);

            CountResponse getPendingUserCount1           = null;
            FeedResponseUserCompactView getPendingUsers1 = null;

            // user2 gets the count of his pending users
            // user2 gets his feed of pending users
            getPendingUserCount1 = await client.MyPendingUsers.GetPendingUsersCountAsync(auth2);

            getPendingUsers1 = await client.MyPendingUsers.GetPendingUsersAsync(auth2, null, 10);

            // user1 gets the profile of user2
            // user2 gets the profile of user1
            var userProfile3 = await client.Users.GetUserAsync(postUserResponse2.UserHandle, auth1);

            var userProfile4 = await client.Users.GetUserAsync(postUserResponse1.UserHandle, auth2);

            // user2 rejects user1's follow request
            await client.MyPendingUsers.DeletePendingUserAsync(postUserResponse1.UserHandle, auth2);

            // user2 gets the count of his pending users
            // user2 gets his feed of pending users
            CountResponse getPendingUserCount2 = await client.MyPendingUsers.GetPendingUsersCountAsync(auth2);

            var getPendingUsers2 = await client.MyPendingUsers.GetPendingUsersAsync(auth2, null, 10);

            // user1 gets the profile of user2
            // user2 gets the profile of user1
            var userProfile5 = await client.Users.GetUserAsync(postUserResponse2.UserHandle, auth1);

            var userProfile6 = await client.Users.GetUserAsync(postUserResponse1.UserHandle, auth2);

            // clean up: delete both users
            await TestUtilities.DeleteUser(client, auth1);

            await TestUtilities.DeleteUser(client, auth2);

            // validate:
            // check that user2's list of pending users includes user1
            // check that user2's list of pending users is empty after the reject
            // check the user profiles to see that follower status and following status are updated correctly
            Assert.AreEqual(1, getPendingUserCount1.Count);
            Assert.AreEqual(0, getPendingUserCount2.Count);

            Assert.AreEqual(postUserResponse1.UserHandle, getPendingUsers1.Data[0].UserHandle);
            Assert.AreEqual(FollowerStatus.None, getPendingUsers1.Data[0].FollowerStatus);
            Assert.AreEqual(Visibility.Public, getPendingUsers1.Data[0].Visibility);

            // Validate User Profiles
            Assert.AreEqual(FollowerStatus.None, userProfile1.FollowerStatus);
            Assert.AreEqual(FollowingStatus.None, userProfile1.FollowingStatus);
            Assert.AreEqual(Visibility.Public, userProfile1.Visibility);

            Assert.AreEqual(FollowerStatus.None, userProfile2.FollowerStatus);
            Assert.AreEqual(FollowingStatus.None, userProfile2.FollowingStatus);
            Assert.AreEqual(Visibility.Public, userProfile2.Visibility);

            Assert.AreEqual(FollowerStatus.Pending, userProfile3.FollowerStatus);
            Assert.AreEqual(FollowingStatus.None, userProfile3.FollowingStatus);
            Assert.AreEqual(Visibility.Private, userProfile3.Visibility);

            Assert.AreEqual(FollowerStatus.None, userProfile4.FollowerStatus);
            Assert.AreEqual(FollowingStatus.Pending, userProfile4.FollowingStatus);
            Assert.AreEqual(Visibility.Public, userProfile4.Visibility);

            Assert.AreEqual(FollowerStatus.None, userProfile5.FollowerStatus);
            Assert.AreEqual(FollowingStatus.None, userProfile5.FollowingStatus);
            Assert.AreEqual(Visibility.Private, userProfile5.Visibility);

            Assert.AreEqual(FollowerStatus.None, userProfile6.FollowerStatus);
            Assert.AreEqual(FollowingStatus.None, userProfile6.FollowingStatus);
            Assert.AreEqual(Visibility.Public, userProfile6.Visibility);
        }
        /// <summary>
        /// Several types of notication test with Get Put and Count
        /// </summary>
        /// <param name="appPublished">flag to indicate if topics are app published</param>
        /// <param name="appHandle">app handle</param>
        /// <returns>Fail if an exception is hit</returns>
        public async Task GetPutCountNotificationTestHelper(bool appPublished, string appHandle)
        {
            SocialPlusClient client1 = new SocialPlusClient(TestConstants.ServerApiBaseUrl);
            SocialPlusClient client2 = new SocialPlusClient(TestConstants.ServerApiBaseUrl);
            SocialPlusClient client3 = new SocialPlusClient(TestConstants.ServerApiBaseUrl);

            PostUserResponse postUserResponse = await TestUtilities.DoLogin(client1, "Stan", "TopicMan", string.Empty);

            string auth1 = AuthHelper.CreateSocialPlusAuth(postUserResponse.SessionToken);

            if (appPublished)
            {
                // add user1 as admin
                bool added = ManageAppsUtils.AddAdmin(TestConstants.EnvironmentName, appHandle, postUserResponse.UserHandle);
                if (!added)
                {
                    // delete the user and fail the test
                    await client1.Users.DeleteUserAsync(auth1);

                    Assert.Fail("Failed to set user as administrator");
                }
            }

            PostUserResponse postUserResponse2 = await TestUtilities.DoLogin(client2, "Emily", "Johnson", string.Empty);

            string           auth2             = AuthHelper.CreateSocialPlusAuth(postUserResponse2.SessionToken);
            PostUserResponse postUserResponse3 = await TestUtilities.DoLogin(client3, "Johnny", "OnTheSpot", string.Empty);

            string auth3 = AuthHelper.CreateSocialPlusAuth(postUserResponse3.SessionToken);

            PublisherType     publisherType     = appPublished ? PublisherType.App : PublisherType.User;
            PostTopicRequest  postTopicRequest  = new PostTopicRequest(publisherType: publisherType, text: "Text", title: "Title", blobHandle: "BlobHandle", language: "en-US", deepLink: "link", categories: "categories", friendlyName: "friendlyName", group: "group");
            PostTopicResponse postTopicResponse = await client1.Topics.PostTopicAsync(postTopicRequest, auth1);

            // all three users like the topic that was created
            await client1.TopicLikes.PostLikeAsync(postTopicResponse.TopicHandle, auth1);

            await client2.TopicLikes.PostLikeAsync(postTopicResponse.TopicHandle, auth2);

            await client3.TopicLikes.PostLikeAsync(postTopicResponse.TopicHandle, auth3);

            if (appPublished)
            {
                // for an app published topic, the topic creator (the content owner) does not receive notifications
                // when the topic is liked.
                await Task.Delay(TestConstants.ServiceBusMediumDelay);

                FeedResponseActivityView notifications1 = await client1.MyNotifications.GetNotificationsAsync(auth1);

                notifications1 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);

                CountResponse count1 = await client1.MyNotifications.GetNotificationsCountAsync(auth1);

                // Clean up state from the test
                await client1.Topics.DeleteTopicAsync(postTopicResponse.TopicHandle, auth1);

                ManageAppsUtils.DeleteAdmin(TestConstants.EnvironmentName, appHandle, postUserResponse.UserHandle);
                await client1.Users.DeleteUserAsync(auth1);

                await client2.Users.DeleteUserAsync(auth2);

                await client3.Users.DeleteUserAsync(auth3);

                // check that no notifications are delivered
                Assert.AreEqual(0, notifications1.Data.Count);
                Assert.AreEqual(0, count1.Count);
            }
            else
            {
                // for a user published topic, user1 (the content owner) should receive two notifications:
                // one when user2 likes the topic, and one when user3 likes the topic
                FeedResponseActivityView notifications1 = null;
                FeedResponseActivityView notifications2 = null;
                FeedResponseActivityView notifications3 = null;
                CountResponse            count1         = null;
                await TestUtilities.AutoRetryServiceBusHelper(
                    async() =>
                {
                    // get the first notification
                    notifications1 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 1);

                    // get the second notification using the first one as the cursor
                    notifications2 = await client1.MyNotifications.GetNotificationsAsync(auth1, notifications1.Cursor, 1);

                    // get up to 10 notifications
                    notifications3 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);

                    // get the count of unread notifications
                    count1 = await client1.MyNotifications.GetNotificationsCountAsync(auth1);
                },
                    () =>
                {
                    // verify
                    Assert.AreEqual(1, notifications1.Data.Count);
                    Assert.AreEqual(ActivityType.Like, notifications1.Data[0].ActivityType);
                    Assert.AreEqual(1, notifications1.Data[0].ActorUsers.Count);
                    Assert.AreEqual(1, notifications1.Data[0].TotalActions);
                    Assert.AreEqual(postTopicResponse.TopicHandle, notifications1.Data[0].ActedOnContent.ContentHandle);
                    Assert.AreEqual(BlobType.Unknown, notifications1.Data[0].ActedOnContent.BlobType);
                    Assert.AreEqual(ContentType.Topic, notifications1.Data[0].ActedOnContent.ContentType);

                    Assert.AreEqual(1, notifications2.Data.Count);
                    Assert.AreEqual(ActivityType.Like, notifications2.Data[0].ActivityType);
                    Assert.AreEqual(1, notifications2.Data[0].ActorUsers.Count);
                    Assert.AreEqual(1, notifications2.Data[0].TotalActions);
                    Assert.AreEqual(postTopicResponse.TopicHandle, notifications2.Data[0].ActedOnContent.ContentHandle);
                    Assert.AreEqual(BlobType.Unknown, notifications2.Data[0].ActedOnContent.BlobType);
                    Assert.AreEqual(ContentType.Topic, notifications2.Data[0].ActedOnContent.ContentType);

                    Assert.AreEqual(2, notifications3.Data.Count);
                    Assert.AreEqual(ActivityType.Like, notifications3.Data[0].ActivityType);
                    Assert.AreEqual(1, notifications3.Data[0].ActorUsers.Count);
                    Assert.AreEqual(1, notifications3.Data[0].TotalActions);
                    Assert.AreEqual(postTopicResponse.TopicHandle, notifications3.Data[0].ActedOnContent.ContentHandle);
                    Assert.AreEqual(BlobType.Unknown, notifications3.Data[0].ActedOnContent.BlobType);
                    Assert.AreEqual(ContentType.Topic, notifications3.Data[0].ActedOnContent.ContentType);

                    Assert.AreEqual(2, count1.Count);
                });

                // Update which is the most recent notification the user has read
                PutNotificationsStatusRequest putNotificationStatusRequest = new PutNotificationsStatusRequest(notifications3.Data.First().ActivityHandle);
                await client1.MyNotifications.PutNotificationsStatusAsync(putNotificationStatusRequest, auth1);

                // Get Notification
                FeedResponseActivityView notifications4 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);

                var count2 = await client1.MyNotifications.GetNotificationsCountAsync(auth1);

                // User3 creates another like on the topic.  Even though this doesn't change
                // the like status because the user has already liked this topic, it does generate
                // another notification.
                await client3.TopicLikes.PostLikeAsync(postTopicResponse.TopicHandle, auth3);

                FeedResponseActivityView notifications5 = null;
                CountResponse            count3         = null;
                await TestUtilities.AutoRetryServiceBusHelper(
                    async() =>
                {
                    // Get new notifications and the count of unread notifications
                    notifications5 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);
                    count3         = await client1.MyNotifications.GetNotificationsCountAsync(auth1);
                }, () =>
                {
                    // verify
                    Assert.AreEqual(2, notifications5.Data.Count);
                    Assert.AreEqual(ActivityType.Like, notifications5.Data[0].ActivityType);
                    Assert.AreEqual(1, notifications5.Data[0].ActorUsers.Count);
                    Assert.AreEqual(1, notifications5.Data[0].TotalActions);
                    Assert.AreEqual(postTopicResponse.TopicHandle, notifications5.Data[0].ActedOnContent.ContentHandle);
                    Assert.AreEqual(BlobType.Unknown, notifications5.Data[0].ActedOnContent.BlobType);
                    Assert.AreEqual(ContentType.Topic, notifications5.Data[0].ActedOnContent.ContentType);

                    Assert.AreEqual(1, count3.Count);
                });

                // User2 deletes their like on the topic.  This generates a notification
                await client2.TopicLikes.DeleteLikeAsync(postTopicResponse.TopicHandle, auth2);

                FeedResponseActivityView notifications6 = null;
                CountResponse            count4         = null;
                await TestUtilities.AutoRetryServiceBusHelper(
                    async() =>
                {
                    // Get new notifications and the count of unread notifications
                    notifications6 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);
                    count4         = await client1.MyNotifications.GetNotificationsCountAsync(auth1);
                }, () =>
                {
                    // verify
                    Assert.AreEqual(1, notifications6.Data.Count);
                    Assert.AreEqual(ActivityType.Like, notifications6.Data[0].ActivityType);
                    Assert.AreEqual(1, notifications6.Data[0].ActorUsers.Count);
                    Assert.AreEqual(1, notifications6.Data[0].TotalActions);
                    Assert.AreEqual(postTopicResponse.TopicHandle, notifications6.Data[0].ActedOnContent.ContentHandle);
                    Assert.AreEqual(BlobType.Unknown, notifications6.Data[0].ActedOnContent.BlobType);
                    Assert.AreEqual(ContentType.Topic, notifications6.Data[0].ActedOnContent.ContentType);

                    Assert.AreEqual(1, count4.Count);
                });

                // User2 once again likes the topic and generates a notification
                await client2.TopicLikes.PostLikeAsync(postTopicResponse.TopicHandle, auth2);

                FeedResponseActivityView notifications7 = null;
                CountResponse            count5         = null;

                await TestUtilities.AutoRetryServiceBusHelper(
                    async() =>
                {
                    // Get new notifications and the count of unread notifications
                    notifications7 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);
                    count5         = await client1.MyNotifications.GetNotificationsCountAsync(auth1);
                }, () =>
                {
                    // verify
                    Assert.AreEqual(2, notifications7.Data.Count);
                    Assert.AreEqual(ActivityType.Like, notifications7.Data[0].ActivityType);
                    Assert.AreEqual(1, notifications7.Data[0].ActorUsers.Count);
                    Assert.AreEqual(1, notifications7.Data[0].TotalActions);
                    Assert.AreEqual(postTopicResponse.TopicHandle, notifications7.Data[0].ActedOnContent.ContentHandle);
                    Assert.AreEqual(BlobType.Unknown, notifications7.Data[0].ActedOnContent.BlobType);
                    Assert.AreEqual(ContentType.Topic, notifications7.Data[0].ActedOnContent.ContentType);

                    Assert.AreEqual(2, count5.Count);
                });

                // Update the most recent notification read
                putNotificationStatusRequest = new PutNotificationsStatusRequest(notifications7.Data.First().ActivityHandle);
                await client1.MyNotifications.PutNotificationsStatusAsync(putNotificationStatusRequest, auth1);

                // Get new notifications and the count of unread notifications
                var notifications8 = await client1.MyNotifications.GetNotificationsAsync(auth1, null, 10);

                var count6 = await client1.MyNotifications.GetNotificationsCountAsync(auth1);

                // Clean up state from the test
                await client1.Topics.DeleteTopicAsync(postTopicResponse.TopicHandle, auth1);

                await client1.Users.DeleteUserAsync(auth1);

                await client2.Users.DeleteUserAsync(auth2);

                await client3.Users.DeleteUserAsync(auth3);

                // Validate everything
                Assert.AreEqual(1, notifications1.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications1.Data[0].ActivityType);
                Assert.AreEqual(1, notifications1.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications1.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications1.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications1.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications1.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(1, notifications2.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications2.Data[0].ActivityType);
                Assert.AreEqual(1, notifications2.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications2.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications2.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications2.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications2.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(2, notifications3.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications3.Data[0].ActivityType);
                Assert.AreEqual(1, notifications3.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications3.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications3.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications3.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications3.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(2, notifications4.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications4.Data[0].ActivityType);
                Assert.AreEqual(1, notifications4.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications4.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications4.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications4.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications4.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(2, notifications5.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications5.Data[0].ActivityType);
                Assert.AreEqual(1, notifications5.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications5.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications5.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications5.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications5.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(1, notifications6.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications6.Data[0].ActivityType);
                Assert.AreEqual(1, notifications6.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications6.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications6.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications6.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications6.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(2, notifications7.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications7.Data[0].ActivityType);
                Assert.AreEqual(1, notifications7.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications7.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications7.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications7.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications7.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(2, notifications8.Data.Count);
                Assert.AreEqual(ActivityType.Like, notifications8.Data[0].ActivityType);
                Assert.AreEqual(1, notifications8.Data[0].ActorUsers.Count);
                Assert.AreEqual(1, notifications8.Data[0].TotalActions);
                Assert.AreEqual(postTopicResponse.TopicHandle, notifications8.Data[0].ActedOnContent.ContentHandle);
                Assert.AreEqual(BlobType.Unknown, notifications8.Data[0].ActedOnContent.BlobType);
                Assert.AreEqual(ContentType.Topic, notifications8.Data[0].ActedOnContent.ContentType);

                Assert.AreEqual(2, count1.Count);
                Assert.AreEqual(0, count2.Count);
                Assert.AreEqual(1, count3.Count);
                Assert.AreEqual(1, count4.Count);
                Assert.AreEqual(2, count5.Count);
                Assert.AreEqual(0, count6.Count);
            }
        }