예제 #1
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>());
        }
예제 #2
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>());
        }