-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
120b18e
commit c65cb30
Showing
5 changed files
with
191 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dotnet pack "src/LightInject/LightInject.csproj" --configuration Release --output "build/Artifacts/NuGet" /property:Version=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using LightInject.SampleLibrary; | ||
using Xunit; | ||
|
||
namespace LightInject.Tests; | ||
|
||
public class ServiceRegistrationEqualsTests | ||
{ | ||
[Fact] | ||
public void ShouldBeEqualWhenServiceTypeAndServiceNameAreTheSame() | ||
{ | ||
var serviceRegistration1 = new ServiceRegistration | ||
{ | ||
ServiceType = typeof(int), | ||
ServiceName = string.Empty | ||
}; | ||
|
||
var serviceRegistration2 = new ServiceRegistration | ||
{ | ||
ServiceType = typeof(int), | ||
ServiceName = string.Empty | ||
}; | ||
|
||
Assert.Equal(serviceRegistration1, serviceRegistration2); | ||
} | ||
|
||
[Fact] | ||
public void ShouldNotBeEqualIfImplementingTypeIsDifferent() | ||
{ | ||
var serviceRegistration1 = new ServiceRegistration | ||
{ | ||
ServiceType = typeof(IFoo), | ||
ServiceName = string.Empty, | ||
ImplementingType = typeof(Foo) | ||
}; | ||
|
||
var serviceRegistration2 = new ServiceRegistration | ||
{ | ||
ServiceType = typeof(IFoo), | ||
ServiceName = string.Empty, | ||
ImplementingType = typeof(AnotherFoo) | ||
}; | ||
|
||
Assert.NotEqual(serviceRegistration1, serviceRegistration2); | ||
} | ||
|
||
[Fact] | ||
public void ShouldNotBeEqualWithMixedImplementingTypeAndFactoryExpression() | ||
{ | ||
var serviceRegistration1 = new ServiceRegistration | ||
{ | ||
ServiceType = typeof(IFoo), | ||
ServiceName = string.Empty, | ||
ImplementingType = typeof(Foo) | ||
}; | ||
|
||
var serviceRegistration2 = new ServiceRegistration | ||
{ | ||
ServiceType = typeof(IFoo), | ||
ServiceName = string.Empty, | ||
FactoryExpression = (IServiceFactory f) => new Foo() | ||
}; | ||
|
||
Assert.NotEqual(serviceRegistration1, serviceRegistration2); | ||
} | ||
} |
Oops, something went wrong.