Exemplo n.º 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));
 }
Exemplo n.º 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)
                };
 }
Exemplo n.º 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"));
 }
Exemplo n.º 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"};
 }
Exemplo n.º 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;
 }