public void WhenNoOpsInAnyContractAreInstrumentedShouldProcessReturnsTrue() { ContractDescription contract1 = ContractBuilder.CreateDescription( typeof(ISimpleService), typeof(SimpleService)); ContractDescription contract2 = ContractBuilder.CreateDescription( typeof(ISimpleService2), typeof(SimpleService)); ContractFilter filter = new ContractFilter(new[] { contract1, contract2 }); foreach (var operation in contract1.Operations) { Assert.IsTrue( filter.ShouldProcess(contract1.Name, contract1.Namespace, operation.Name), "Operation {0} not processed", operation.Name); } foreach (var operation in contract2.Operations) { Assert.IsTrue( filter.ShouldProcess(contract2.Name, contract2.Namespace, operation.Name), "Operation {0} not processed", operation.Name); } }
public void WhenOpsInOneContractAreInstrumentedShouldProcessReturnsTrueForAllInstrumented() { ContractDescription contract1 = ContractBuilder.CreateDescription( typeof(ISimpleService), typeof(SimpleService) ); ContractDescription contract2 = ContractBuilder.CreateDescription( typeof(ISelectiveTelemetryService), typeof(SelectiveTelemetryService) ); // Only check contract 1 operations ContractFilter filter = new ContractFilter(new[] { contract1, contract2 }); foreach (var operation in contract1.Operations) { Assert.IsTrue( filter.ShouldProcess(contract1.Name, contract1.Namespace, operation.Name), "Operation {0} not processed", operation.Name ); } // Check instrumented operation in second contract Assert.IsTrue( filter.ShouldProcess(contract2.Name, contract2.Namespace, "OperationWithTelemetry"), "Operation {0} not processed", "OperationWithTelemetry" ); }
public void WhenAnOpIsNotBeenInstrumentedShouldProcessReturnsFalse() { ContractDescription contract = ContractBuilder.CreateDescription( typeof(ISelectiveTelemetryService), typeof(SelectiveTelemetryService)); var filter = new OperationFilter(contract); Assert.IsFalse( filter.ShouldProcess("OperationWithoutTelemetry"), "ShouldProcessRequest('OperationWithoutTelemetry') returned true"); }
public void WhenOpsInOneContractAreInstrumentedShouldProcessReturnsFalseForAllInstrumented() { ContractDescription contract1 = ContractBuilder.CreateDescription( typeof(ISimpleService), typeof(SimpleService)); ContractDescription contract2 = ContractBuilder.CreateDescription( typeof(ISelectiveTelemetryService), typeof(SelectiveTelemetryService)); ContractFilter filter = new ContractFilter(new[] { contract1, contract2 }); Assert.IsFalse( filter.ShouldProcess(contract2.Name, contract2.Namespace, "OperationWithoutTelemetry"), "Operation {0} is processed", "OperationWithoutTelemetry"); }
public void WhenNoOpsAreInstrumentedShouldProcessReturnsTrue() { ContractDescription contract = ContractBuilder.CreateDescription( typeof(ISimpleService), typeof(SimpleService)); var filter = new OperationFilter(contract); foreach (var operation in contract.Operations) { Assert.IsTrue( filter.ShouldProcess(operation.Name), "Operation {0} not processed", operation.Name); } }
public void BehaviorCreatesCustomBindingWithTimeouts() { var binding = new NetTcpBinding() { OpenTimeout = new TimeSpan(1, 0, 0), SendTimeout = new TimeSpan(2, 0, 0), ReceiveTimeout = new TimeSpan(3, 0, 0), CloseTimeout = new TimeSpan(4, 0, 0) }; var contract = ContractBuilder.CreateDescription(typeof(ISimpleService), typeof(SimpleService)); var ep = new ServiceEndpoint(contract, binding, new EndpointAddress("net.tcp://localhost:8765")); IEndpointBehavior behavior = new ClientTelemetryEndpointBehavior(); behavior.AddBindingParameters(ep, new BindingParameterCollection()); Assert.AreEqual(binding.OpenTimeout, ep.Binding.OpenTimeout); Assert.AreEqual(binding.SendTimeout, ep.Binding.SendTimeout); Assert.AreEqual(binding.ReceiveTimeout, ep.Binding.ReceiveTimeout); Assert.AreEqual(binding.CloseTimeout, ep.Binding.CloseTimeout); }
private static ServiceEndpoint CreateEndpoint() { var contractDescription = ContractBuilder.CreateDescription(typeof(ISimpleService), typeof(SimpleService)); return(new ServiceEndpoint(contractDescription)); }