コード例 #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>());
        }
コード例 #2
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>());
        }