コード例 #1
0
ファイル: TopicsFixture.cs プロジェクト: jasondentler/Hermes
        public void Should_get_all_topic()
        {
            var group = new M.Group { Id = Identity.Random() };
            var topics = new M.Topic[]
                             {
                                new M.Topic{
                                Description = "description 1",
                                GroupId = group.Id.Value ,
                                Id = Identity.Random(),
                                Name = "test 1"
                                },
                                new M.Topic{
                                Description = "description 2",
                                GroupId = group.Id.Value ,
                                Id = Identity.Random(),
                                Name = "test 2"
                                }
                             };

            mockedGenericJsonQuery.Setup(r => r.Execute<Topic>(null, null, null)).Returns(topics);

            var result = client.ExecuteGet<F.Topic[]>("");

            Assert.IsNotNull(topics);
            Assert.AreEqual(topics.Length, result.Length);
            Assert.IsTrue(topics.All(t1 => result.Any(t2 => t1.Id == t2.Id.ToModel() && t1.Name == t2.Name)));
        }
コード例 #2
0
ファイル: TopicsFixture.cs プロジェクト: ashic/Hermes
        public void Should_get_all_topic()
        {
            var group = new M.Group {
                Id = Identity.Random()
            };
            var topics = new M.Topic[]
            {
                new M.Topic {
                    Description = "description 1",
                    GroupId     = group.Id.Value,
                    Id          = Identity.Random(),
                    Name        = "test 1"
                },
                new M.Topic {
                    Description = "description 2",
                    GroupId     = group.Id.Value,
                    Id          = Identity.Random(),
                    Name        = "test 2"
                }
            };

            mockedGenericJsonQuery.Setup(r => r.Execute <Topic>(null, null, null)).Returns(topics);

            var result = client.ExecuteGet <F.Topic[]>("");

            Assert.IsNotNull(topics);
            Assert.AreEqual(topics.Length, result.Length);
            Assert.IsTrue(topics.All(t1 => result.Any(t2 => t1.Id == t2.Id.ToModel() && t1.Name == t2.Name)));
        }