Example #1
0
        public void RaiseProductVisitedEvent_IfProductIsNull_ShouldThrowException()
        {
            // arrange
            ProductModel product = null;
            var          service = new CommerceAnalyticsService(this.analyticsManager, this.storefrontContext);

            // act & assert
            Assert.ThrowsAny <ArgumentNullException>(() => { service.RaiseProductVisitedEvent(product); });
            this.analyticsManager.Received(0).VisitedProductDetailsPage(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>());
        }
Example #2
0
        public void RaiseCategoryVisitedEvent_IfCategoryIsNull_ShouldThrowException()
        {
            // arrange
            CategoryModel category = null;
            var           service  = new CommerceAnalyticsService(this.analyticsManager, this.storefrontContext);

            // act & assert
            Assert.ThrowsAny <ArgumentNullException>(() => { service.RaiseCategoryVisitedEvent(category); });
            this.analyticsManager.Received(0).VisitedCategoryPage(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>());
        }
Example #3
0
        public void RaiseProductVisitedEvent_IfProductIsNotNull_ShouldRaiseEvent()
        {
            // arrange
            var product = new ProductModel(this.fixture.Create <Item>());
            var service = new CommerceAnalyticsService(this.analyticsManager, this.storefrontContext);

            // act
            service.RaiseProductVisitedEvent(product);

            // assert
            this.analyticsManager.Received(1).VisitedProductDetailsPage(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>());
        }
Example #4
0
        public void RaiseCategoryVisitedEvent_IfCategoryIsNotNull_ShouldRaiseEvent()
        {
            // arrange
            var category = new CategoryModel(this.fixture.Create <Item>());
            var service  = new CommerceAnalyticsService(this.analyticsManager, this.storefrontContext);

            // act
            service.RaiseCategoryVisitedEvent(category);

            // assert
            this.analyticsManager.Received(1).VisitedCategoryPage(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>());
        }