Preview:
[Test]
public void If$ParameterName$IsNull_ThrowsException()
{
// Arrange & Act
Action act = () => $END$;
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using FluentAssertions; | |
using Microsoft.Azure.Functions.Extensions.DependencyInjection; | |
using Microsoft.Extensions.DependencyInjection; | |
using Moq; | |
using Xunit; | |
namespace MyUnitTestProject; |
A meta-analysis by Károly Ozsvárt
// Based on https://stackoverflow.com/q/7368652/4215389 | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
namespace app | |
{ | |
public class Program |
public static bool IsSet2<T>(this T self, T flag) where T : Enum | |
{ | |
return (self & flag) == flag; | |
} |
public static class MyExtensions | |
{ | |
public static bool IsSet(this Color self, Color flag) | |
{ | |
return (self & flag) == flag; | |
} | |
} |
// preform (this & flags) != flags | |
FCIMPL2(FC_BOOL_RET, ReflectionEnum::InternalHasFlag, Object *pRefThis, Object* pRefFlags) | |
{ | |
FCALL_CONTRACT; | |
VALIDATEOBJECT(pRefThis); | |
BOOL cmp = false; | |
_ASSERTE(pRefFlags != NULL); // Enum.cs would have thrown ArgumentNullException before calling into InternalHasFlag |