public void SetUp() { Matcher = new ExactTypeConstraint(typeof(D1)); GoodValues = new object[] { new D1() }; BadValues = new object[] { new B(), new D2() }; Description = "<NUnit.Framework.Constraints.Tests.D1>"; }
public void SetUp() { Matcher = new ExactTypeConstraint(typeof(D1)); GoodValues = new object[] { new D1() }; BadValues = new object[] { new B(), new D2() }; Description = "<NUnit.Framework.Constraints.Tests.D1>"; }
public void GetPartitionPropertiesAsyncValidatesThePartition(string partition) { ExactTypeConstraint typeConstraint = partition is null ? Throws.ArgumentNullException : Throws.ArgumentException; var client = new AmqpEventHubClient("my.eventhub.com", "somePath", Mock.Of <TokenCredential>(), new EventHubClientOptions(), Mock.Of <EventHubRetryPolicy>()); Assert.That(async() => await client.GetPartitionPropertiesAsync(partition, CancellationToken.None), typeConstraint); }
public void GetPartitionPropertiesAsyncValidatesThePartition(string partition) { ExactTypeConstraint typeConstraint = partition is null ? Throws.ArgumentNullException : Throws.ArgumentException; var credential = new Mock <EventHubTokenCredential>(Mock.Of <TokenCredential>(), "{namespace}.servicebus.windows.net"); var client = new AmqpClient("my.eventhub.com", "somePath", credential.Object, new EventHubConnectionOptions()); Assert.That(async() => await client.GetPartitionPropertiesAsync(partition, Mock.Of <EventHubsRetryPolicy>(), CancellationToken.None), typeConstraint); }
public void ParseValidatesArguments(string connectionString) { ExactTypeConstraint typeConstraint = connectionString is null ? Throws.ArgumentNullException : Throws.ArgumentException; Assert.That(() => ConnectionStringParser.Parse(connectionString), typeConstraint); }
public void SetUp() { theConstraint = new ExactTypeConstraint(typeof(D1)); expectedDescription = string.Format("<{0}>", typeof(D1)); stringRepresentation = string.Format("<typeof {0}>", typeof(D1)); }
public void CompositeConstructorValidatesTheResource(string resource) { ExactTypeConstraint typeConstraint = resource is null ? Throws.ArgumentNullException : Throws.ArgumentException; Assert.That(() => new SharedAccessSignature(resource, "Yay", "OMG!", TimeSpan.FromMilliseconds(500)), typeConstraint); }
public void SignatureOnlyConstructorValidatesTheSignature(string signature) { ExactTypeConstraint typeConstraint = signature is null ? Throws.ArgumentNullException : Throws.ArgumentException; Assert.That(() => new SharedAccessSignature(signature), typeConstraint); }
public void SetUp() { theConstraint = new ExactTypeConstraint(typeof(D1)); expectedDescription = string.Format("<{0}>", typeof(D1)); stringRepresentation = string.Format("<typeof {0}>", typeof(D1)); }
public static EqualConstraint ForParameter(this ExactTypeConstraint constraint, string name) { return(constraint.With.Property("ParamName").EqualTo(name)); }
public static EqualConstraint Because(this ExactTypeConstraint constraint, string exceptionMessage) => constraint.With.Message.EqualTo(exceptionMessage);
public void ParseToConnectionStringsArguments(string connectionString) { ExactTypeConstraint typeConstraint = connectionString is null ? Throws.ArgumentNullException : Throws.ArgumentException; Assert.That(() => ServiceBusConnectionStringProperties.Parse(connectionString), typeConstraint); }
public void GetPropertyValueThrowsException(object obj, string propertyName, ExactTypeConstraint throwsException, string exceptionMessage) => Assert.That(() => obj.GetPropertyValue(propertyName), throwsException?.With.Message.EqualTo(exceptionMessage));
public void SetPropertyValueThrowsException(object obj, string propertyName, ExactTypeConstraint throwsException, string exceptionMessage) { const int notByte = 256; Assert.That(() => obj.SetPropertyValue(propertyName, RandomUtil.Randomizer.Next(notByte, int.MaxValue)), throwsException?.With.Message.EqualTo(exceptionMessage)); }
/// <summary> /// Determines whether the asserted type contains a property named "ParamName" with the value of <paramref name="paramName"/>. /// </summary> /// <param name="constraint"></param> /// <param name="paramName"></param> /// <returns></returns> public static EqualConstraint WithParamName(this ExactTypeConstraint constraint, string paramName) { return(constraint.With.Property(nameof(ArgumentException.ParamName)).EqualTo(paramName)); }