public async Task PublishAsync(Guid id, JObject content) { ServiceContract.RequireNotNull(id, nameof(id)); ServiceContract.RequireNotDefaultValue(id, nameof(id)); await new BusinessEvents(BusinessEventsBaseUrl, _tenant, _tokenRefresher.GetServiceClient()).PublishAsync(id, content); }
public void FalseParameter() { const string parameterName = "parameterName"; try { const int value = 0; // ReSharper disable once ExpressionIsAlwaysNull ServiceContract.RequireNotDefaultValue(value, parameterName); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail("An exception should have been thrown"); } catch (FulcrumServiceContractException fulcrumException) { Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(fulcrumException.TechnicalMessage.Contains(parameterName)); } catch (Exception e) { Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail($"Expected a specific FulcrumException but got {e.GetType().FullName}."); } }