public void RaiseProductVisitedEvent_IfProductIsNull_ShouldThrowException() { // arrange Product product = null; var service = new AnalyticsService(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>()); }
public void RaiseProductVisitedEvent_IfProductIsNotNull_ShouldRaiseEvent() { // arrange var product = this.fixture.Create <Product>(); var service = new AnalyticsService(this.analyticsManager, this.storefrontContext); // act service.RaiseProductVisitedEvent(product); // assert this.analyticsManager.Received(1) .VisitedProductDetailsPage(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }