public void ModelToFacadeMapsCorrectly()
        {
            var model = new Topic
                            {
                                Id = Identity.Random(),
                                Description = _description,
                                Name = _name,
                                GroupId = _groupId
                            };

            var facade = model.ToFacade();

            Assert.That(facade.Id, Is.EqualTo(model.Id.ToFacade()));
            Assert.That(facade.Description, Is.EqualTo(model.Description));
            Assert.That(facade.Name, Is.EqualTo(model.Name));

            facade.Links.Should().Contain(new Link(ResourceLocation.OfGroup(_groupId),
                                                   TellagoStudios.Hermes.RestService.Constants.Relationships.Group));
        }
Beispiel #2
0
        public void ModelToFacadeMapsCorrectly()
        {
            var model = new Topic
            {
                Id          = Identity.Random(),
                Description = _description,
                Name        = _name,
                GroupId     = _groupId
            };

            var facade = model.ToFacade();

            Assert.That(facade.Id, Is.EqualTo(model.Id.ToFacade()));
            Assert.That(facade.Description, Is.EqualTo(model.Description));
            Assert.That(facade.Name, Is.EqualTo(model.Name));

            facade.Links.Should().Contain(new Link(ResourceLocation.OfGroup(_groupId),
                                                   TellagoStudios.Hermes.RestService.Constants.Relationships.Group));
        }
Beispiel #3
0
        static public Facade.Topic ToFacade(this Topic from)
        {
            if (from == null)
            {
                return(null);
            }
            Guard.Instance.ArgumentNotNull(() => from.Id, from.Id);

            return(new Facade.Topic
            {
                Id = from.Id.Value.ToFacade(),
                Name = from.Name,
                Description = from.Description,
                Links =
                {
                    from.GroupId.ToLink(Constants.Relationships.Group),
                    new Link(ResourceLocation.OfTopic(from.Id.Value),                "Delete"),
                    new Link(ResourceLocation.OfTopic(from.Id.Value),                "Update"),
                    new Link(ResourceLocation.OfCreateMessageIngTopic(from.Id.Value),"Post Message"),
                    new Link(ResourceLocation.OfCurrentTopicFeed(from.Id.Value),     "Current Feed")
                }
            });
        }