Пример #1
0
        public async Task GetAllTest()
        {
            var membershipCard1 = new MembershipCard()
            {
                Id = 1, CreatedAt = date1, MemberId = 1
            };
            var membershipCard2 = new MembershipCard()
            {
                Id = 2, CreatedAt = date2, MemberId = 2
            };
            var membershipCards = new List <MembershipCard> {
                membershipCard1, membershipCard2
            };

            var fakeMembershipCardRepositoryMock = new Mock <IMembershipCardRepository>();
            var fakeMemberRepositoryMock         = new Mock <IMemberRepository>();

            fakeMembershipCardRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(membershipCards);

            var membershipCardService = new MembershipCardService(fakeMembershipCardRepositoryMock.Object, fakeMemberRepositoryMock.Object);

            var resultMembershipCardes = await membershipCardService.GetAllMembershipCards();

            Assert.Collection(resultMembershipCardes, membershipCard =>
            {
                Assert.Equal(date1, membershipCard.CreatedAt);
            },
                              membershipCard =>
            {
                Assert.Equal(date2, membershipCard.CreatedAt);
            });
        }
Пример #2
0
 // GET: MembershipCards
 public async Task <IActionResult> Index()
 {
     return(View(await _membershipCardService.GetAllMembershipCards()));
 }