コード例 #1
0
 private void MockAuthorizationForStartechsWhichUserIsLeader()
 {
     StartechAuthorizationService.Setup(x => x.IsMemberOrLeaderOf(Startechs.Agile, true)).Returns(Task.Factory.StartNew(() => true));
     foreach (Startechs startech in Enum.GetValues(typeof(Startechs)).Cast <Startechs>().Where(x => x != Startechs.Agile))
     {
         StartechAuthorizationService.Setup(x => x.IsMemberOrLeaderOf(startech, true)).Returns(Task.Factory.StartNew(() => false));
     }
 }
コード例 #2
0
        private void Authorize(StarpointsItem starpointsItem, bool isLeader = false)
        {
            var isLeaderValue = isLeader;
            var itemsStartech = starpointsItem.Startech;

            StartechAuthorizationService.Setup(x => x.IsMemberOrLeaderOf(It.IsIn(itemsStartech), It.IsIn(true)))
            .Returns(Task.Factory.StartNew(() => isLeader));
        }
コード例 #3
0
 private void MockAuthorizationForAvailableStartechs()
 {
     StartechAuthorizationService.Setup(x => x.IsMemberOrLeaderOf(Startechs.Java, false)).Returns(Task.Factory.StartNew(() => true));
     foreach (Startechs startech in Enum.GetValues(typeof(Startechs)).Cast <Startechs>().Where(x => x != Startechs.Java))
     {
         StartechAuthorizationService.Setup(x => x.IsMemberOrLeaderOf(startech, false)).Returns(Task.Factory.StartNew(() => false));
     }
 }