-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
7 changed files
with
136 additions
and
3 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
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,31 @@ | ||
// Copyright (c) Adriano Ueda. All rights reserved. | ||
|
||
namespace FxCopDemo.Tests | ||
{ | ||
using FxCopDemo; | ||
using Xunit; | ||
|
||
public class IEmptyInterface2Tests | ||
{ | ||
/// <summary> | ||
/// Tests if mock class implements interface. | ||
/// </summary> | ||
[Fact] | ||
public void TestsIfObjectImplementsInterface() | ||
{ | ||
var mockObject = new MockEmptyInterface(); | ||
|
||
var actual = mockObject is IEmptyInterface2; | ||
|
||
Assert.True(actual); | ||
} | ||
|
||
/// <summary> | ||
/// Implements a mock class. | ||
/// </summary> | ||
private class MockEmptyInterface | ||
: IEmptyInterface2 | ||
{ | ||
} | ||
} | ||
} |
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,39 @@ | ||
// Copyright (c) Adriano Ueda. All rights reserved. | ||
|
||
namespace FxCopDemo.Tests | ||
{ | ||
using FxCopDemo; | ||
using Xunit; | ||
|
||
public class IEmptyInterfaceTests | ||
{ | ||
/// <summary> | ||
/// Tests if mock class implements interface. | ||
/// </summary> | ||
[Fact] | ||
public void TestsIfObjectImplementsInterface() | ||
{ | ||
var mockObject = new MockEmptyInterface(); | ||
|
||
var actual = mockObject is IEmptyInterface; | ||
|
||
Assert.True(actual); | ||
} | ||
|
||
/// <summary> | ||
/// Implements a mock class. | ||
/// </summary> | ||
private class MockEmptyInterface | ||
: IEmptyInterface | ||
{ | ||
/// <summary> | ||
/// Returns the name of the mock object. | ||
/// </summary> | ||
/// <returns>The name of mock object.</returns> | ||
public string GetName() | ||
{ | ||
return "Mockup Empty Interface"; | ||
} | ||
} | ||
} | ||
} |
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,23 @@ | ||
// Copyright (c) Adriano Ueda. All rights reserved. | ||
|
||
namespace FxCopDemo | ||
{ | ||
/// <summary> | ||
/// Empty interface for demo purposes. | ||
/// </summary> | ||
/// <remarks> | ||
/// Set DISABLE_FIXES to see FxCop in action. | ||
/// </remarks> | ||
public interface IEmptyInterface | ||
{ | ||
// Example 3: FxCop will throw a CA1040 warning. | ||
// Implements an empty interface. | ||
#if !DISABLE_FIXES | ||
/// <summary> | ||
/// Gets the property name. | ||
/// </summary> | ||
/// <returns>The name.</returns> | ||
string GetName(); | ||
#endif | ||
} | ||
} |
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,25 @@ | ||
// Copyright (c) Adriano Ueda. All rights reserved. | ||
|
||
namespace FxCopDemo | ||
{ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
// Example 4: FxCop will not throw a CA1040 warning. | ||
// Implements an empty interface but FxCop will not | ||
// throw an exception because it was told to ignore | ||
// it using the SuppressMessage attribute. | ||
|
||
/// <summary> | ||
/// Empty interface for demo purposes. | ||
/// </summary> | ||
/// <remarks> | ||
/// Set DISABLE_FIXES to see FxCop in action. | ||
/// FxCop will throw the CA1040 warning. | ||
/// </remarks> | ||
#if !DISABLE_FIXES | ||
[SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] | ||
#endif | ||
public interface IEmptyInterface2 | ||
{ | ||
} | ||
} |
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