public void Require_Access_Token() { var configurationMock = new Mock <IOptions <RollbarOptions> >(); configurationMock.Setup(c => c.Value).Returns(new RollbarOptions()); var configurationBuilder = new RollbarDotNet.Builder.ConfigurationBuilder(configurationMock.Object); var exception = Assert.Throws <InvalidOperationException>(() => configurationBuilder.Execute(new Payloads.Payload())); Assert.Equal("Configuration variable for your Rollbar AccessToken must be set (did you include services.Configure<RollbarOptions>?).", exception.Message); }
public void SetsPayload() { var configurationMock = new Mock <IOptions <RollbarOptions> >(); configurationMock.Setup(c => c.Value).Returns(new RollbarOptions { AccessToken = ACCESSTOKEN, Environment = ENVIRONMENT }); var configurationBuilder = new RollbarDotNet.Builder.ConfigurationBuilder(configurationMock.Object); var payload = new Payloads.Payload(); configurationBuilder.Execute(payload); Assert.Equal(ACCESSTOKEN, payload.AccessToken); Assert.Equal(ENVIRONMENT, payload.Data?.Environment); }