-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathAssembly.cs
More file actions
80 lines (67 loc) · 2.12 KB
/
Assembly.cs
File metadata and controls
80 lines (67 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Collections.Generic;
using System.Linq;
namespace ArchUnitNET.Domain
{
public class Assembly : IHasName, IHasAttributes
{
public Assembly(
string name,
string fullName,
bool isOnlyReferenced,
List<string> referencedAssemblyNames
)
{
Name = name;
FullName = fullName;
IsOnlyReferenced = isOnlyReferenced;
ReferencedAssemblyNames = referencedAssemblyNames;
}
public bool IsOnlyReferenced { get; }
public string Name { get; }
public List<string> ReferencedAssemblyNames { get; }
public string FullName { get; }
public IEnumerable<Attribute> Attributes =>
AttributeInstances.Select(instance => instance.Type);
public List<AttributeInstance> AttributeInstances { get; } = new List<AttributeInstance>();
public bool Equals(Assembly other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return Equals(Name, other.Name)
&& Equals(FullName, other.FullName)
&& Equals(IsOnlyReferenced, other.IsOnlyReferenced);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((Assembly)obj);
}
public override int GetHashCode()
{
unchecked
{
var hashCode = Name != null ? Name.GetHashCode() : 0;
hashCode = (hashCode * 397) ^ (FullName != null ? FullName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ IsOnlyReferenced.GetHashCode();
return hashCode;
}
}
}
}