示例#1
0
        public void GetByUserTest()
        {
            var id   = new Guid();
            var list = new List <Subscriber>()
            {
                new Subscriber()
                {
                    Id            = new Guid(),
                    UserProfileId = id
                },
                new Subscriber()
                {
                    Id            = new Guid(),
                    UserProfileId = new Guid()
                }
            };
            var unit = new MockUnitOfWork();

            unit.MockRepository();
            unit.MockGetAllForRep(list);
            var service = new SubscriberService(unit.Object);

            var res = service.GetByUser(id).GetAwaiter().GetResult();

            Assert.NotNull(res);
            Assert.NotEmpty(res);
            Assert.Equal(id, res.First().UserProfileId);
            Assert.IsAssignableFrom <IEnumerable <Subscriber> >(res);
        }