public void verifier_should_throw_exception_on_different_consumer_name()
        {
            var verifier = new AgreementVerifer()
                           .Provider("TestProvider")
                           .HasAgreementWith("BreakConsumer")
                           .WithMessage(new BaseSchemaMessage())
                           .WithMetaData(new { messageNamespace = typeof(BaseSchemaMessage).FullName })
                           .WithAgreementDestination(Path.Combine(schemasBaseUri,
                                                                  "TestProvider-TestConsumer-BaseSchemaMessage.json"));

            Action verifyAction = () => { verifier.Verify(); };

            verifyAction.Should().Throw <AgreementViolationException>().WithMessage(string.Format(ExceptionMessages.InvalidConsumerName, "TestConsumer", "BreakConsumer"));
        }
        public void verifier_should_throw_exception_on_different_meta_data()
        {
            var verifier = new AgreementVerifer()
                           .Provider("TestProvider")
                           .HasAgreementWith("TestConsumer")
                           .WithMessage(new BaseSchemaMessage())
                           .WithMetaData(new { messageNamespace = typeof(int).Name })
                           .WithAgreementDestination(Path.Combine(schemasBaseUri,
                                                                  "TestProvider-TestConsumer-BaseSchemaMessage.json"));

            var expectedMetadata = "{\"messageNamespace\":\"ServicesAgreement.Tests.Verifier.BaseSchemaMessage\"}";
            var actualMetadata   = "{\"messageNamespace\":\"Int32\"}";

            Action verifyAction = () => { verifier.Verify(); };

            verifyAction.Should().Throw <AgreementViolationException>().WithMessage(string.Format(ExceptionMessages.InvalidMetadata, expectedMetadata, actualMetadata));
        }
        public async void PublisherTest()
        {
            var bus     = Substitute.For <IBus>();
            var prodSrv = new ProductService(bus, new FakeContext());
            await prodSrv.AddProduct(new ProductDto { Name = "Test" });

            var message = bus.ReceivedCalls().First(x => x.GetMethodInfo().Name == "Publish").GetArguments()[0];

            var currentDir  = Directory.GetCurrentDirectory();
            var withoutbin  = currentDir.Split("bin")[0];
            var destination = withoutbin + "Message.Publisher-Message.Reciever-ProductAdded.json";

            var verifier = new AgreementVerifer()
                           .Provider("Message.Publisher")
                           .HasAgreementWith("Message.Reciever")
                           .WithMessage(message)
                           .WithAgreementDestination(destination);

            verifier.Verify();
        }