You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.8 KiB
C#
78 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
using Xunit;
|
|
|
|
using Study.DelegateSeries.Core;
|
|
using Study.DelegateSeries.Core.Calculator;
|
|
|
|
namespace Study.DelegateSeries.Test
|
|
{
|
|
public class StudyDelegateTest : IDisposable, IClassFixture<StudyDelegate>
|
|
{
|
|
#region 准备
|
|
private StudyDelegate studyDelegate;
|
|
|
|
public StudyDelegateTest(StudyDelegate _studyDelegate)
|
|
{
|
|
this.studyDelegate = _studyDelegate;
|
|
}
|
|
#endregion
|
|
|
|
#region xUnit框架可能性测试
|
|
[Fact]
|
|
public void FixtureTest()
|
|
{
|
|
Assert.NotNull(studyDelegate);
|
|
}
|
|
#endregion
|
|
|
|
#region 实例化委托测试
|
|
[Fact]
|
|
public void BaseInstanceTest()
|
|
{
|
|
var baseInstance = this.studyDelegate.BaseInstance();
|
|
|
|
Assert.NotNull(baseInstance);
|
|
Assert.True(baseInstance.Method.IsPublic);
|
|
}
|
|
|
|
[Fact]
|
|
public void AutoTypeInstanceTest()
|
|
{
|
|
var baseInstance = this.studyDelegate.AutoTypeInstance();
|
|
|
|
Assert.NotNull(baseInstance);
|
|
Assert.Equal("Difference", baseInstance.Method.Name);
|
|
}
|
|
|
|
[Fact]
|
|
public void AnonymousInstanceTest()
|
|
{
|
|
var baseInstance = this.studyDelegate.AnonymousInstance();
|
|
|
|
Assert.NotNull(baseInstance);
|
|
Assert.False(baseInstance.Method.IsSpecialName);
|
|
}
|
|
|
|
[Fact]
|
|
public void LambdaInstanceTest()
|
|
{
|
|
var baseInstance = this.studyDelegate.LambdaInstance();
|
|
|
|
Assert.NotNull(baseInstance);
|
|
Assert.False(baseInstance.Method.IsSpecialName);
|
|
}
|
|
#endregion
|
|
|
|
#region 清理
|
|
void IDisposable.Dispose()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|