Exemplo n.º 1
0
 public Entity([NotNull] IEntityLookup entityLookup)
 {
     Id             = entityLookup.GetNextEntityId();
     m_entityLookup = entityLookup;
     m_components   = new Dictionary <Type, ComponentBase>();
     ComponentKey   = ComponentKey.Empty;
 }
Exemplo n.º 2
0
        public void RegisterManagementProcessors_RegistersManagementProcessor_WhenEntityHasDeliveryQueue()
        {
            IEntity testEntity = Substitute.For <IEntity>();

            testEntity.Name.Returns("zb");
            testEntity.DeliveryQueue.Returns(new DeliveryQueue());
            var testEntities = new List <(string Address, IEntity entity)> {
                ("zb", testEntity)
            };
            IEntityLookup fakeEntityLookup = Substitute.For <IEntityLookup>();

            fakeEntityLookup.GetEnumerator().Returns(testEntities.GetEnumerator());
            ILoggerProvider fakeLoggerProvider = Substitute.For <ILoggerProvider>();
            IContainerHost  fakeHost           = Substitute.For <IContainerHost>();

            fakeHost.RegisterManagementProcessors(fakeEntityLookup, fakeLoggerProvider);

            fakeHost.ShouldSatisfyAllConditions(
                () => fakeHost
                .Received(1)
                .RegisterRequestProcessor("zb/$management", Arg.Any <ManagementRequestProcessor>()),
                () => fakeLoggerProvider
                .Received(1)
                .CreateLogger(nameof(ManagementRequestProcessor))
                );
        }
Exemplo n.º 3
0
        public ExistsElementValidator(IEntityLookup lookupRepo)
        {
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));

            _lookupRepo = lookupRepo;
            RuleFor(e => e.Id).GreaterThan(0).Must(Exists);
        }
        private static void CreatePlanetEntity(string[] parts, IEntityLookup entityLookup, Dictionary <string, Entity> entities, Action <string> throwFormatException)
        {
            if (parts.Length != 11)
            {
                throwFormatException($"Planet data must have 11 fields, but found {parts.Length} fields.");
            }

            var name   = parts[1];
            var radius = double.Parse(parts[2]);
            var mass   = double.Parse(parts[3]);

            if (mass < 0)
            {
                mass = 1e12 * (4.0 / 3.0) * PI * radius * radius * radius * mass;
            }
            var parentId             = entities[parts[4]].Id;
            var semiMajorAxis        = double.Parse(parts[5]);
            var eccentricity         = double.Parse(parts[6]);
            var longitudeOfPeriapsis = double.Parse(parts[7]);
            var meanAnomaly          = double.Parse(parts[8]);
            var isRetrograde         = int.Parse(parts[9]) != 0;
            var epoch = int.Parse(parts[10]);

            var entity = EntityUtility.CreatePlanet(entityLookup, name, parentId, mass, radius, semiMajorAxis, eccentricity, longitudeOfPeriapsis, meanAnomaly, isRetrograde, epoch);

            entities.Add(name, entity);
        }
Exemplo n.º 5
0
        public async Task Process_CompleteWithError_WhenOutgoingLinkQueueNotFound()
        {
            const string     linkName        = "abcd";
            const string     entity          = "entity";
            ISecurityContext securityContext = Substitute.For <ISecurityContext>();
            IEntityLookup    entityLookup    = Substitute.For <IEntityLookup>();
            ILoggerProvider  loggerProvider  = Substitute.For <ILoggerProvider>();

            Entities.IEntity fakeEntity = Substitute.For <Entities.IEntity>();
            var linkProcessor           = new LinkProcessor(securityContext, entityLookup, loggerProvider);

            fakeEntity.DeliveryQueue.Returns((DeliveryQueue)null);
            entityLookup.Find(Arg.Any <string>()).Returns(fakeEntity);
            securityContext.IsAuthorized(Arg.Any <Connection>()).Returns(true);
            AmqpException exception = null;
            Session       session   = await TestAmqpHost.OpenAndLinkProcessorAsync(linkProcessor);

            try
            {
                var receiver = new ReceiverLink(session, linkName, entity);

                Func <Task> action = async() => await receiver.ReceiveAsync();

                linkProcessor.ShouldSatisfyAllConditions(
                    () => exception = action.ShouldThrow <AmqpException>(),
                    () => exception.Error.Condition.ShouldBe((Symbol)ErrorCode.NotFound),
                    () => exception.Error.Description.ShouldBe("Queue not found.")
                    );
            }
            finally
            {
                await session.Connection.CloseAsync();
            }
        }
Exemplo n.º 6
0
        public override void UpdateFromEntity(IEntityLookup entityLookup)
        {
            var entity = entityLookup.GetEntity(EntityId);

            var information = entity.GetOptionalComponent <InformationComponent>();

            Name = information?.Name;

            var population = entity.GetOptionalComponent <PopulationComponent>();

            Cohorts    = population?.Populations.FirstOrDefault();
            Population = population?.Populations.Sum(x => x.TotalPopulation) ?? 0;

            var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>();
            var body     = entity.GetRequiredComponent <OrbitalBodyCharacteristicsComponent>();

            Radius = body.Radius;
            var parentEntity = position.ParentId.HasValue ? entityLookup.GetEntity(position.ParentId.Value) : null;

            OrbitCenterPosition = parentEntity?.GetOptionalComponent <EllipticalOrbitalPositionComponent>()?.GetCurrentAbsolutePosition(entityLookup) ?? new Point();
            Position            = position.RelativePosition.WithOffset(OrbitCenterPosition);
            PositionString      = "{0}, {1}".FormatCurrentCulture(Position.X, Position.Y);
            SemiMajorAxis       = position.SemiMajorAxis ?? 0.0;
            SemiMinorAxis       = position.SemiMinorAxis ?? 0.0;
            Focus = position.Focus ?? 0.0;
            LongitudeOfPeriapsis = position.LongitudeOfPeriapsis ?? 0.0;
        }
Exemplo n.º 7
0
        public async Task Process_CompleteSuccessfully_WhenOutgoingLinkQueueFound()
        {
            const string     linkName        = "abcd";
            const string     entity          = "entity";
            ISecurityContext securityContext = Substitute.For <ISecurityContext>();
            IEntityLookup    entityLookup    = Substitute.For <IEntityLookup>();
            ILoggerProvider  loggerProvider  = Substitute.For <ILoggerProvider>();

            Entities.IEntity fakeEntity = Substitute.For <Entities.IEntity>();
            var deliveryQueue           = new DeliveryQueue();
            var linkProcessor           = new LinkProcessor(securityContext, entityLookup, loggerProvider);

            entityLookup.Find(Arg.Any <string>()).Returns(fakeEntity);
            securityContext.IsAuthorized(Arg.Any <Connection>()).Returns(true);
            fakeEntity.DeliveryQueue.Returns(deliveryQueue);
            Session session = await TestAmqpHost.OpenAndLinkProcessorAsync(linkProcessor);

            try
            {
                var receiver = new ReceiverLink(session, linkName, entity);
                deliveryQueue.Enqueue(new Delivery(new Message {
                    Properties = new Properties {
                        MessageId = "msgid6746"
                    }
                }));

                Message message = await receiver.ReceiveAsync();

                message.Properties.MessageId.ShouldBe("msgid6746");
            }
            finally
            {
                await session.Connection.CloseAsync();
            }
        }
Exemplo n.º 8
0
        public override MovementOrderBase PrepareIntercept(IEntityLookup entityLookup, Point currentAbsolutePosition, double maxSpeedPerTick, TimePoint currentTime)
        {
            if (InterceptPoint.HasValue)
            {
                return(null);
            }

            MoveToOrbitalBodyOrder newOrder = null;
            var targetEntity     = entityLookup.GetEntity(TargetEntityId);
            var targetOrders     = targetEntity.GetOptionalComponent <OrdersComponent>();
            var targetUnitDesign = targetEntity.GetOptionalComponent <OrbitalUnitDesignComponent>();

            if (MovementOrderUtility.CanExecuteOrders(targetOrders, targetUnitDesign))
            {
                throw new NotImplementedException();
            }
            else
            {
                var speedPerTick   = Math.Min(SpeedPerTick, maxSpeedPerTick);
                var interceptPoint = MovementOrderUtility.GetInterceptPoint(entityLookup, currentAbsolutePosition, speedPerTick, targetEntity, currentTime);
                newOrder = CloneWithIntercept(interceptPoint);
            }

            return(newOrder);
        }
Exemplo n.º 9
0
 public AutomobileXmlNoteSerializer(IApplication app, ILogger <AutomobileInfo> logger, IEntityLookup lookupRepo) : base(logger)
 {
     Guard.Against <ArgumentNullException>(app == null, nameof(app));
     Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));
     _app        = app;
     _lookupRepo = lookupRepo;
 }
Exemplo n.º 10
0
        public AuthorEfRepository(IHmmDataContext dataContext, IEntityLookup lookupRepo)
        {
            Guard.Against <ArgumentNullException>(dataContext == null, nameof(dataContext));
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));

            _dataContext = dataContext;
            _lookupRepo  = lookupRepo;
        }
Exemplo n.º 11
0
 public AdminNameOverlay(AdminSystem system, IEntityManager entityManager, IEyeManager eyeManager, IResourceCache resourceCache, IEntityLookup entityLookup)
 {
     _system        = system;
     _entityManager = entityManager;
     _eyeManager    = eyeManager;
     _entityLookup  = entityLookup;
     ZIndex         = 200;
     _font          = new VectorFont(resourceCache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), 10);
 }
Exemplo n.º 12
0
        public NoteCatalogController(INoteCatalogManager catalogManager, IMapper mapper, IEntityLookup lookupRepo)
        {
            Guard.Against <ArgumentNullException>(catalogManager == null, nameof(catalogManager));
            Guard.Against <ArgumentNullException>(mapper == null, nameof(mapper));
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));

            _catalogManager = catalogManager;
            _mapper         = mapper;
            _lookupRepo     = lookupRepo;
        }
Exemplo n.º 13
0
        protected RepositoryBase(IHmmDataContext dataContext, IEntityLookup lookupRepo, IDateTimeProvider dateTimeProvider)
        {
            Guard.Against <ArgumentNullException>(dataContext == null, nameof(dataContext));
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));
            Guard.Against <ArgumentNullException>(dateTimeProvider == null, nameof(dateTimeProvider));

            DataContext      = dataContext;
            LookupRepo       = lookupRepo;
            DateTimeProvider = dateTimeProvider;
        }
Exemplo n.º 14
0
        public void GoToEntity(EntityId entityId, IEntityLookup entityLookup)
        {
            var entity = entityLookup.GetEntity(entityId);

            if (entity != null)
            {
                var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>();
                Center = position.GetCurrentAbsolutePosition(entityLookup);
            }
        }
Exemplo n.º 15
0
        public NoteCatalogManager(IRepository <NoteCatalog> dataSource, IHmmValidator <NoteCatalog> validator, IEntityLookup lookupRepo)
        {
            Guard.Against <ArgumentNullException>(dataSource == null, nameof(dataSource));
            Guard.Against <ArgumentNullException>(validator == null, nameof(validator));
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));

            _dataSource = dataSource;
            _validator  = validator;
            _lookupRepo = lookupRepo;
        }
Exemplo n.º 16
0
 internal static void RegisterManagementProcessors(this IContainerHost host, IEntityLookup entityLookup, ILoggerProvider loggerProvider)
 {
     foreach ((string Address, IEntity Entity)item in entityLookup)
     {
         if (item.Entity.DeliveryQueue != null)
         {
             host.RegisterRequestProcessor(item.Address + "/$management", new ManagementRequestProcessor(loggerProvider));
         }
     }
 }
Exemplo n.º 17
0
 public AutomobileValidator(IEntityLookup lookupRepo) : base(lookupRepo)
 {
     RuleFor(a => a.AuthorId).Must(HasValidAuthor).WithMessage("Have valid default author for Automobile");
     RuleFor(a => a.Maker).NotEmpty().WithMessage("Have valid automobile maker");
     RuleFor(a => a.Brand).NotEmpty().WithMessage("Have valid automobile brand");
     RuleFor(a => a.Year).NotEmpty().WithMessage("Have valid Year of the automobile");
     RuleFor(a => a.Color).NotEmpty().WithMessage("Have valid color of the automobile");
     RuleFor(a => a.Pin).NotEmpty().WithMessage("Have valid PIN of the automobile");
     RuleFor(a => a.Plate).NotEmpty().WithMessage("Have valid plate of the automobile");
     RuleFor(a => a.MeterReading).GreaterThan(0).WithMessage("Have valid meter reading of the automobile");
 }
Exemplo n.º 18
0
        protected EntityManagerBase(IHmmValidator <T> validator, IHmmNoteManager noteManager, IEntityLookup lookupRepo)
        {
            Guard.Against <ArgumentNullException>(validator == null, nameof(validator));
            Guard.Against <ArgumentNullException>(noteManager == null, nameof(noteManager));
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));

            Validator     = validator;
            NoteManager   = noteManager;
            LookupRepo    = lookupRepo;
            DefaultAuthor = ApplicationRegister.DefaultAuthor;
        }
Exemplo n.º 19
0
        private static double GetPositionDifference(IEntityLookup entityLookup, EllipticalOrbitalPositionComponent targetPosition, Point interceptorPosition, double interceptorSpeedPerTick, int tick, TimePoint currentTime)
        {
            var targetAbsolutePosition = targetPosition.GetAbsoluteOrbitalPositionAtTime(entityLookup, currentTime + new TimeOffset(tick));
            var v1 = new Vector(interceptorPosition.X, interceptorPosition.Y);
            var v2 = new Vector(targetAbsolutePosition.X, targetAbsolutePosition.Y);
            var v  = v2 - v1;
            var distanceToTarget = v.Length;

            v.Normalize();
            v = v * interceptorSpeedPerTick * tick;
            return(v.Length - distanceToTarget);
        }
Exemplo n.º 20
0
        public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime)
        {
            var entities = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey <ShipyardComponent>());

            foreach (var entity in entities)
            {
                if (((newTime.Tick - 1) % (int)Math.Round(Constants.TicksPerDay * 365.25 * 5)) == 0)
                {
                    var position = entity.GetRequiredComponent <EllipticalOrbitalPositionComponent>().GetCurrentAbsolutePosition(entityLookup);
                    EntityUtility.CreateShip(entityLookup, $"Discovery {Interlocked.Increment(ref m_shipId)}", position);
                }
            }
        }
        public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime)
        {
            var entitiesList = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey(typeof(PopulationComponent)));

            foreach (var entity in entitiesList)
            {
                var component   = entity.GetRequiredComponent <PopulationComponent>();
                var populations = component.Populations;
                foreach (var population in populations)
                {
                    var newPops = PopulationUtility.ProcessTick(population, out var _);
                    component.SetPopulation(population.RacialTemplate, newPops);
                }
            }
        }
        private static void CreateStarEntity(string[] parts, IEntityLookup entityLookup, Dictionary <string, Entity> entities, Action <string> throwFormatException)
        {
            if (parts.Length != 4)
            {
                throwFormatException($"Star data must have 4 fields, but found {parts.Length} fields.");
            }

            var name   = parts[1];
            var radius = double.Parse(parts[2]);
            var mass   = double.Parse(parts[3]);

            var entity = EntityUtility.CreatePlanet(entityLookup, name, mass, radius);

            entities.Add(name, entity);
        }
Exemplo n.º 23
0
        public static async Task <int> GetCatalogIdAsync(this AutomobileBase entity, IEntityLookup lookup)
        {
            if (lookup == null)
            {
                throw new ArgumentNullException(nameof(lookup));
            }
            var catalogId = 0;

            switch (entity)
            {
            case AutomobileInfo:
                var autoCats = await lookup.GetEntitiesAsync <NoteCatalog>(cat =>
                                                                           cat.Name == AutomobileConstant.AutoMobileInfoCatalogName);

                var autoCat = autoCats.FirstOrDefault();
                if (autoCat != null)
                {
                    catalogId = autoCat.Id;
                }
                break;

            case GasDiscount:
                var discountCats = await lookup.GetEntitiesAsync <NoteCatalog>(cat => cat.Name == AutomobileConstant.GasDiscountCatalogName);

                var discountCat = discountCats.FirstOrDefault();
                if (discountCat != null)
                {
                    catalogId = discountCat.Id;
                }
                break;

            case GasLog:
                var logCats = await lookup.GetEntitiesAsync <NoteCatalog>(cat => cat.Name == AutomobileConstant.GasLogCatalogName);

                var logCat = logCats.FirstOrDefault();
                if (logCat != null)
                {
                    catalogId = logCat.Id;
                }
                break;

            default:
                catalogId = 0;
                break;
            }

            return(catalogId);
        }
Exemplo n.º 24
0
        public GasLogValidator(IEntityLookup lookupRepo, IDateTimeProvider dateTimeProvider) : base(lookupRepo)
        {
            Guard.Against <ArgumentNullException>(dateTimeProvider == null, nameof(dateTimeProvider));
            _dateTimeProvider = dateTimeProvider;

            RuleFor(l => l.AuthorId).Must(HasValidAuthor).WithMessage("Has valid author for GasLog");
            RuleFor(l => l.Date).NotNull().Must(HasValidDate).WithMessage("Gas log does not has valid date");
            RuleFor(l => l.Car).NotNull().WithMessage("Gas log must belongs to an automobile");
            RuleFor(l => l.Distance).Must((o, distance) => HasValidDistance2(distance, o.CurrentMeterReading)).WithMessage("Need has valid distance");
            RuleFor(l => l.CurrentMeterReading).Must((o, meter) => HasValidDistance2(o.Distance, meter)).WithMessage("Need has valid meter reading");
            RuleFor(l => l.Gas).Must(HasValidVolume).WithMessage("Need has valid gas volume");
            RuleFor(l => l.Price).Must(HasValidMoney).WithMessage("Need has valid Price");
            RuleFor(l => l.Station).Length(1, 1000).WithMessage("Need has gas station");
            RuleFor(l => l.CreateDate).Must(HasValidEarlyDate).WithMessage("Create date should not earlier then today");
            RuleForEach(l => l.Discounts).SetValidator(new GasDiscountInfoValidator(lookupRepo)).WithMessage("All valid GasDiscountInfo is required");
        }
Exemplo n.º 25
0
        public static Entity CreatePlanet(IEntityLookup entityLookup, string name, double mass, double radius)
        {
            var planet = new Entity(entityLookup);

            planet.AddComponent(new InformationComponent {
                Name = name
            });
            planet.AddComponent(EllipticalOrbitalPositionComponent.CreateUnpoweredBody());
            planet.AddComponent(new OrbitalBodyCharacteristicsComponent
            {
                Mass   = mass,
                Radius = radius,
            });

            entityLookup.RegisterEntity(planet);
            return(planet);
        }
Exemplo n.º 26
0
        public GasLogXmlNoteSerializer(
            IApplication app,
            ILogger <GasLog> logger,
            IAutoEntityManager <AutomobileInfo> autoManager,
            IAutoEntityManager <GasDiscount> discountManager,
            IEntityLookup lookupRepo)
            : base(logger)
        {
            Guard.Against <ArgumentNullException>(app == null, nameof(app));
            Guard.Against <ArgumentNullException>(autoManager == null, nameof(autoManager));
            Guard.Against <ArgumentNullException>(discountManager == null, nameof(discountManager));
            Guard.Against <ArgumentNullException>(lookupRepo == null, nameof(lookupRepo));

            _app             = app;
            _autoManager     = autoManager;
            _discountManager = discountManager;
            _lookupRepo      = lookupRepo;
        }
Exemplo n.º 27
0
        public static Entity CreatePlanet(IEntityLookup entityLookup, string name, EntityId parentId, double mass, double radius, double semiMajorAxis, double eccentricity, double longitudeOfPeriapsis, double meanAnomaly, bool isRetrograde, int epoch)
        {
            var planet = new Entity(entityLookup);

            planet.AddComponent(new InformationComponent {
                Name = name
            });

            // TODO: calculate correct initial position usinig epoch

            planet.AddComponent(EllipticalOrbitalPositionComponent.CreateUnpoweredBody(parentId, semiMajorAxis, eccentricity, longitudeOfPeriapsis, meanAnomaly, isRetrograde));
            planet.AddComponent(new OrbitalBodyCharacteristicsComponent
            {
                Mass   = mass,
                Radius = radius,
            });

            entityLookup.RegisterEntity(planet);
            return(planet);
        }
Exemplo n.º 28
0
        public override void ProcessTick(IEntityLookup entityLookup, NotificationLog notificationLog, TimePoint newTime)
        {
            var entitiesList = entityLookup.GetEntitiesMatchingKey(entityLookup.CreateComponentKey(typeof(AgeComponent)));

            foreach (var entity in entitiesList)
            {
                AgeComponent ageComponent   = entity.GetRequiredComponent <AgeComponent>();
                double       survivalChance = 0.998;

                /*
                 * GetSurvivalChance(
                 * ageComponent.GetAge(GameData.CurrentDate).Days,
                 * ageComponent.Template.MeanDaysBetweenFailures,
                 * ageComponent.Template.AgeRiskDoublingDays);
                 */
                if (m_rng.NextDouble() > survivalChance)
                {
                    // death
                }
            }
        }
Exemplo n.º 29
0
        public async Task Process_CompleteWithError_WhenIncomingLinkEntityNotFound()
        {
            const string     linkName        = "abcd";
            const string     entity          = "entity";
            ISecurityContext securityContext = Substitute.For <ISecurityContext>();
            IEntityLookup    entityLookup    = Substitute.For <IEntityLookup>();
            ILoggerProvider  loggerProvider  = Substitute.For <ILoggerProvider>();
            var linkProcessor = new LinkProcessor(securityContext, entityLookup, loggerProvider);

            entityLookup.Find(Arg.Any <string>()).Returns((Entities.IEntity)null);
            securityContext.IsAuthorized(Arg.Any <Connection>()).Returns(true);
            AmqpException exception = null;
            Session       session   = await TestAmqpHost.OpenAndLinkProcessorAsync(linkProcessor);

            try
            {
                var sender  = new SenderLink(session, linkName, entity);
                var message = new Message
                {
                    Properties = new Properties {
                        MessageId = "message1"
                    },
                    BodySection = new Data {
                        Binary = Encoding.UTF8.GetBytes("hello!")
                    }
                };
                Func <Task> action = async() => await sender.SendAsync(message);

                linkProcessor.ShouldSatisfyAllConditions(
                    () => exception = action.ShouldThrow <AmqpException>(),
                    () => exception.Error.Condition.ShouldBe((Symbol)ErrorCode.NotFound),
                    () => exception.Error.Description.ShouldBe("Entity not found.")
                    );
            }
            finally
            {
                await session.Connection.CloseAsync();
            }
        }
Exemplo n.º 30
0
        public async Task Process_CompleteSuccessfully_WhenIncomingLinkEntityFound()
        {
            const string     linkName        = "abcd";
            const string     entity          = "myEntity";
            ISecurityContext securityContext = Substitute.For <ISecurityContext>();
            IEntityLookup    entityLookup    = Substitute.For <IEntityLookup>();
            ILoggerProvider  loggerProvider  = Substitute.For <ILoggerProvider>();

            Entities.IEntity fakeEntity = Substitute.For <Entities.IEntity>();
            var linkProcessor           = new LinkProcessor(securityContext, entityLookup, loggerProvider);

            entityLookup.Find(entity).Returns(fakeEntity);
            securityContext.IsAuthorized(Arg.Any <Connection>()).Returns(true);
            Session session = await TestAmqpHost.OpenAndLinkProcessorAsync(linkProcessor);

            try
            {
                var sender  = new SenderLink(session, linkName, entity);
                var message = new Message
                {
                    Properties = new Properties {
                        MessageId = "message173"
                    },
                    BodySection = new Data {
                        Binary = Encoding.UTF8.GetBytes("hello!")
                    }
                };

                await sender.SendAsync(message);

                fakeEntity
                .Received(1)
                .Post(Arg.Is <Message>(m => m.Properties.MessageId == "message173"));
            }
            finally
            {
                await session.Connection.CloseAsync();
            }
        }