예제 #1
0
 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>";
 }
예제 #2
0
 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>";
 }
예제 #3
0
        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);
        }
예제 #5
0
        public void ParseValidatesArguments(string connectionString)
        {
            ExactTypeConstraint typeConstraint = connectionString is null ? Throws.ArgumentNullException : Throws.ArgumentException;

            Assert.That(() => ConnectionStringParser.Parse(connectionString), typeConstraint);
        }
예제 #6
0
 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);
        }
예제 #9
0
 public void SetUp()
 {
     theConstraint        = new ExactTypeConstraint(typeof(D1));
     expectedDescription  = string.Format("<{0}>", typeof(D1));
     stringRepresentation = string.Format("<typeof {0}>", typeof(D1));
 }
예제 #10
0
 public static EqualConstraint ForParameter(this ExactTypeConstraint constraint, string name)
 {
     return(constraint.With.Property("ParamName").EqualTo(name));
 }
예제 #11
0
파일: TestHelper.cs 프로젝트: flyer87/C6
 public static EqualConstraint Because(this ExactTypeConstraint constraint, string exceptionMessage)
 => constraint.With.Message.EqualTo(exceptionMessage);
예제 #12
0
        public void ParseToConnectionStringsArguments(string connectionString)
        {
            ExactTypeConstraint typeConstraint = connectionString is null ? Throws.ArgumentNullException : Throws.ArgumentException;

            Assert.That(() => ServiceBusConnectionStringProperties.Parse(connectionString), typeConstraint);
        }
예제 #13
0
 public void GetPropertyValueThrowsException(object obj, string propertyName, ExactTypeConstraint throwsException, string exceptionMessage) =>
 Assert.That(() => obj.GetPropertyValue(propertyName), throwsException?.With.Message.EqualTo(exceptionMessage));
예제 #14
0
        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));
 }