public void RaiseCategoryVisitedEvent_IfCategoryIsNull_ShouldThrowException() { // arrange Category category = null; var service = new AnalyticsService(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>()); }
public void RaiseCategoryVisitedEvent_IfCategoryIsNotNull_ShouldRaiseEvent() { // arrange var category = this.fixture.Create <Category>(); var service = new AnalyticsService(this.analyticsManager, this.storefrontContext); // act service.RaiseCategoryVisitedEvent(category); // assert this.analyticsManager.Received(1) .VisitedCategoryPage(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }