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)); }
public AccessGroup ToViewModel(AccessGroupDTO dto) { return new AccessGroup { Id = dto.Id, Name = dto.Name, Type = dto.Type, Description = dto.Description, RolesThatHaveAccess = MapRolesInDto(dto.RolesThatHaveAccess) }; }
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")); }
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"}; }
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; }