Example #1
0
        public void TestNoViewings()
        {
            var jobAdId = Guid.NewGuid();

            Assert.AreEqual(0, _jobAdViewsQuery.GetViewedCount(jobAdId));
            Assert.AreEqual(0, _jobAdViewsQuery.GetDistinctViewedCount(jobAdId));

            Assert.IsFalse(_jobAdViewsQuery.HasViewedJobAd(Guid.NewGuid(), jobAdId));

            Assert.AreEqual(0, _jobAdViewsQuery.GetViewedJobAdIds(Guid.NewGuid(), new[] { jobAdId }).Count);
            Assert.AreEqual(0, _jobAdViewsQuery.GetViewedJobAdIds(Guid.NewGuid()).Count);
        }
Example #2
0
        public void TestAnonymous()
        {
            var employer = CreateEmployer();
            var jobAd    = employer.CreateTestJobAd();

            _jobAdsCommand.CreateJobAd(jobAd);
            _jobAdsCommand.OpenJobAd(jobAd);

            Get(HomeUrl);
            var anonymousId = GetAnonymousId();

            Assert.IsTrue(_jobAdViewsQuery.GetViewedJobAdIds(anonymousId, new[] { jobAd.Id }).CollectionEqual(new Guid[0]));
            Assert.AreEqual(0, _jobAdViewsQuery.GetViewedCount(jobAd.Id));

            // View.

            AssertJsonSuccess(Deserialize <JsonResponseModel>(Post(GetViewedUrl(jobAd.Id))));
            Assert.IsTrue(_jobAdViewsQuery.GetViewedJobAdIds(anonymousId, new[] { jobAd.Id }).CollectionEqual(new[] { jobAd.Id }));
            Assert.IsTrue(_jobAdViewsQuery.HasViewedJobAd(anonymousId, jobAd.Id));
        }