public void MessageSender_ConstructsExpectedString_FromWindowRuleBreach()
        {
            // arrange
            var messageSender = new HighVolumeMessageSender(
                this.logger,
                this.queueCasePublisher,
                this.repository,
                this.ordersRepository,
                this.ruleBreachToRuleBreachOrdersMapper,
                this.ruleBreachToRuleBreachMapper);

            var venueVolumeBreach = new HighVolumeRuleBreach.BreachDetails(true, 0.4212m, 103918412, this.market);
            var ruleBreach        = A.Fake <IHighVolumeRuleBreach>();

            A.CallTo(() => ruleBreach.WindowBreach).Returns(venueVolumeBreach);
            A.CallTo(() => ruleBreach.TotalOrdersTradedInWindow).Returns(10241.0000m);

            var parameters = A.Fake <IHighVolumeRuleEquitiesParameters>();

            A.CallTo(() => parameters.HighVolumePercentageWindow).Returns(0.32123m);
            A.CallTo(() => parameters.Windows).Returns(new TimeWindows("a", TimeSpan.FromHours(3)));

            var order = new Order().Random();

            A.CallTo(() => ruleBreach.Security).Returns(order.Instrument);
            A.CallTo(() => ruleBreach.EquitiesParameters).Returns(parameters);

            // act
            var message = messageSender.BuildDescription(ruleBreach);

            // assert
            Assert.AreEqual("High Volume rule breach detected for random-security. Percentage of window volume breach has occured. A window volume limit of 32.12% was exceeded by trading 42.12% of window volume within the window of 180 minutes at the venue (XLON) London Stock Exchange. 10241 volume was the allocated fill against a breach threshold volume of 103918412.", message);
        }
        public void MessageSender_ConstructsExpectedString_FromMarketCapRuleBreach()
        {
            // arrange
            var messageSender = new HighVolumeMessageSender(
                this.logger,
                this.queueCasePublisher,
                this.repository,
                this.ordersRepository,
                this.ruleBreachToRuleBreachOrdersMapper,
                this.ruleBreachToRuleBreachMapper);

            var marketCapBreach =
                new HighVolumeRuleBreach.BreachDetails(
                    true,
                    0.4212m,
                    new Money(10029, "GBX"),
                    new Money(99924.12m, "USD"),
                    this.market);

            var ruleBreach = A.Fake <IHighVolumeRuleBreach>();

            A.CallTo(() => ruleBreach.MarketCapBreach).Returns(marketCapBreach);
            A.CallTo(() => ruleBreach.TotalOrdersTradedInWindow).Returns(10241.000300m);

            var parameters = A.Fake <IHighVolumeRuleEquitiesParameters>();

            A.CallTo(() => parameters.HighVolumePercentageMarketCap).Returns(0.12123m);
            A.CallTo(() => parameters.Windows).Returns(new TimeWindows("a", TimeSpan.FromHours(3)));

            var order = new Order().Random();

            A.CallTo(() => ruleBreach.Security).Returns(order.Instrument);
            A.CallTo(() => ruleBreach.EquitiesParameters).Returns(parameters);

            // act
            var message = messageSender.BuildDescription(ruleBreach);

            // assert
            Assert.AreEqual("High Volume rule breach detected for random-security. Percentage of market capitalisation breach has occured. A limit of 12.12% was exceeded by trading 42.12% of market capitalisation.  (USD) 99924.12 was traded against a breach threshold value of (USD) 10029.", message);
        }