コード例 #1
0
 public void UpdateOneGroupAccessShouldCallRepository()
 {
     var acc = new AccessGroupDTO();
     var accView = new AccessGroup();
     _accessGroupRepositoryMock.Setup(x => x.UpdateOne(acc)).Returns(StorageResult.Success);
     var result = _subject.UpdateOneAccessGroup(accView);
     Assert.That(result, Is.EqualTo(StorageResult.Success));
 }
コード例 #2
0
 public AccessGroup ToViewModel(AccessGroupDTO dto)
 {
     return new AccessGroup
                {
                    Id = dto.Id,
                    Name = dto.Name,
                    Type = dto.Type,
                    Description = dto.Description,
                    RolesThatHaveAccess = MapRolesInDto(dto.RolesThatHaveAccess)
                };
 }
コード例 #3
0
 public void GetOneAccessGroupShouldCallRepository()
 {
     var id = new Guid();
     var acc = new AccessGroupDTO
                   {
                       Id = id,
                       Name = "Test"
                   };
     _accessGroupRepositoryMock.Setup(x => x.GetOne(id)).Returns(acc);
     _accessGroupMapper.Setup(x => x.ToViewModel(acc)).Returns(new AccessGroup {Id = id, Name = "Test"});
     var result = _subject.GetOneAccessGroup(id);
     Assert.That(result.Name, Is.EqualTo("Test"));
 }
コード例 #4
0
 private void SetUp()
 {
     _subject = new AccessGroupRepository();
     _ag1 = new AccessGroupDTO {Name = "Test1", Type = "Testgruppe", Description = "Første testgruppe"};
     _ag2 = new AccessGroupDTO {Name = "Test1", Type = "Testgruppe", Description = "Andre testgruppe"};
     _ag3 = new AccessGroupDTO {Name = "Test3", Type = "Testgruppe", Description = "Tredje testgruppe"};
 }
コード例 #5
0
 private static bool IsInCollection(AccessGroupDTO u, IEnumerable<AccessGroupDTO> fromDb)
 {
     foreach (var d in fromDb)
     {
         if (d.Id == u.Id && d.Name == u.Name && d.Type == u.Type && d.Description == u.Description && d.RolesThatHaveAccess == u.RolesThatHaveAccess)
             return true;
     }
     return false;
 }