Esempio n. 1
0
 public void Show()
 {
     List<Group> groups = new List<Group>();
     groups.Add(new Group
     {
         Id = 1,
         Name = "Group1",
         Type = GroupType.Public,
     });
     FakeGroupRepository repo = new FakeGroupRepository(groups);
     FakeUserRepository userRepo = new FakeUserRepository(new List<UserProfile>());
     GroupService groupService = new GroupService(repo, userRepo);
     GroupsController controller = new GroupsController(groupService, new UserService());
     ViewResult res = controller.Show(1) as ViewResult;
     GroupsShowViewModel viewModel = (GroupsShowViewModel)res.Model;
     var expected = new GroupsShowViewModel { Id = 1, Name = "Group1" };
     Assert.AreEqual(viewModel.Id, expected.Id);
 }
Esempio n. 2
0
 public GroupServiceTest()
 {
     List<Group> groups = new List<Group>();
     groups.Add(new Group
     {
         Id = 1,
         Name = "Group1",
         Type = GroupType.Public,
         Owner = new UserProfile
         {
             UserId = 1,
             UserName = "******"
         },
         Trainers = new List<UserProfile> {
             new UserProfile{
                 UserId=1,
                 UserName="******"
             },
             new UserProfile{
                 UserId=2,
                 UserName="******"
             },
         },
         Members = new List<UserProfile> {
             new UserProfile{
                 UserId=3,
                 UserName="******"
             },
             new UserProfile{
                 UserId=4,
                 UserName="******"
             },
         },
     });
     groups.Add(new Group
     {
         Id = 2,
         Name = "Group2",
         Type = GroupType.Private,
         Owner = new UserProfile
         {
             UserId = 2,
             UserName = "******"
         },
         Members = new List<UserProfile> {
             new UserProfile{
                 UserId=1,
                 UserName="******"
             },
             new UserProfile{
                 UserId=4,
                 UserName="******"
             },
         },
     });
     groups.Add(new Group
     {
         Id = 3,
         Name = "Group3",
         Type = GroupType.Private,
         Owner = new UserProfile
         {
             UserId = 1,
             UserName = "******"
         },
         Members = new List<UserProfile> {
             new UserProfile{
                 UserId=3,
                 UserName="******"
             },
             new UserProfile{
                 UserId=1,
                 UserName="******"
             },
         },
     });
     this.repo = new FakeGroupRepository(groups);
     this.userRepo = new FakeUserRepository(new List<UserProfile>());
     this.groupService = new GroupService(repo, userRepo);
 }