text:
struct FrameMsg_BuffersSwapped_Params;
struct FrameMsg_CompositorFrameSwapped_Params;

namespace content {

class ChildFrameCompositingHelper;
class RenderFrameImpl;
class RenderViewImpl;

// When a page's frames are rendered by multiple processes, each renderer has a
// full copy of the frame tree. It has full RenderFrames for the frames it is
// responsible for rendering and placeholder objects for frames rendered by
// other processes. This class is the renderer-side object for the placeholder.
// RenderFrameProxy allows us to keep existing window references valid over
// cross-process navigations and route cross-site asynchronous JavaScript calls,
// such as postMessage.
//
// For now, RenderFrameProxy is created when RenderFrame is swapped out. It
// acts as a wrapper and is used for sending and receiving IPC messages. It is
// deleted when the RenderFrame is swapped back in or the node of the frame
// tree is deleted.
//
// Long term, RenderFrameProxy will be created to replace the RenderFrame in the
// frame tree and the RenderFrame will be deleted after its unload handler has
// finished executing. It will still be responsible for routing IPC messages
// which are valid for cross-site interactions between frames.
// RenderFrameProxy will be deleted when the node in the frame tree is deleted
// or when navigating the frame causes it to return to this process and a new
// RenderFrame is created for it.
class CONTENT_EXPORT RenderFrameProxy
    : public IPC::Listener,
      public IPC::Sender,
      NON_EXPORTED_BASE(public blink::WebRemoteFrameClient) {
 public:
  // This method should be used to create a RenderFrameProxy, which will replace
  // an existing RenderFrame during its cross-process navigation from the
  // current process to a different one. |routing_id| will be ID of the newly
  // created RenderFrameProxy. |frame_to_replace| is the frame that the new
  // proxy will eventually swap places with.
  static RenderFrameProxy* CreateProxyToReplaceFrame(
      RenderFrameImpl* frame_to_replace,
      int routing_id);

  // This method should be used to create a RenderFrameProxy, when there isn't
  // an existing RenderFrame. It should be called to construct a local
  // representation of a RenderFrame that has been created in another process --
  // for example, after a cross-process navigation or after the addition of a
  // new frame local to some other process. |routing_id| will be the ID of the
  // newly created RenderFrameProxy. |parent_routing_id| is the routing ID of
  // the RenderFrameProxy to which the new frame is parented.
  // |render_view_routing_id| identifies the RenderView to be associated with
  // this frame.
  //
  // |parent_routing_id| always identifies a RenderFrameProxy (never a
  // RenderFrame) because a new child of a local frame should always start out
  // as a frame, not a proxy.
  static RenderFrameProxy* CreateFrameProxy(int routing_id,
                                            int parent_routing_id,
                                            int render_view_routing_id);

  // Returns the RenderFrameProxy for the given routing ID.
  static RenderFrameProxy* FromRoutingID(int routing_id);

  // Returns the RenderFrameProxy given a WebFrame.
  static RenderFrameProxy* FromWebFrame(blink::WebFrame* web_frame);

  virtual ~RenderFrameProxy();

  // IPC::Sender
  virtual bool Send(IPC::Message* msg) OVERRIDE;

  // Out-of-process child frames receive a signal from RenderWidgetCompositor
  // when a compositor frame has committed.
  void DidCommitCompositorFrame();

  int routing_id() { return routing_id_; }
  RenderViewImpl* render_view() { return render_view_; }
  blink::WebRemoteFrame* web_frame() { return web_frame_; }

  // blink::WebRemoteFrameClient implementation:
  virtual void postMessageEvent(
      blink::WebLocalFrame* sourceFrame,
      blink::WebRemoteFrame* targetFrame,
      blink::WebSecurityOrigin target,
      blink::WebDOMMessageEvent event);
  virtual void initializeChildFrame(
      const blink::WebRect& frame_rect,
      float scale_factor);

 private:
  RenderFrameProxy(int routing_id, int frame_routing_id);

  void Init(blink::WebRemoteFrame* frame, RenderViewImpl* render_view);

  // IPC::Listener
  virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;

  // IPC handlers
  void OnDeleteProxy();
  void OnChildFrameProcessGone();
  void OnCompositorFrameSwapped(const IPC::Message& message);
  void OnDisownOpener();

  // The routing ID by which this RenderFrameProxy is known.
  const int routing_id_;

  // The routing ID of the local RenderFrame (if any) which this
  // RenderFrameProxy is meant to replace in the frame tree.
  const int frame_routing_id_;

  // Stores the WebRemoteFrame we are associated with.
  blink::WebRemoteFrame* web_frame_;
  scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;

  RenderViewImpl* render_view_;

  DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy);
};

}  // namespace

#endif  // CONTENT_RENDERER_RENDER_FRAME_PROXY_H_


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle;
using Microsoft.CodeAnalysis.CSharp.TypeStyle;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UseImplicitType
{
    public partial class UseImplicitTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
    {
        internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
            => (new CSharpUseImplicitTypeDiagnosticAnalyzer(), new UseImplicitTypeCodeFixProvider());

        private static readonly CodeStyleOption<bool> onWithSilent = new CodeStyleOption<bool>(true, NotificationOption.Silent);
        private static readonly CodeStyleOption<bool> offWithSilent = new CodeStyleOption<bool>(false, NotificationOption.Silent);
        private static readonly CodeStyleOption<bool> onWithInfo = new CodeStyleOption<bool>(true, NotificationOption.Suggestion);
        private static readonly CodeStyleOption<bool> offWithInfo = new CodeStyleOption<bool>(false, NotificationOption.Suggestion);
        private static readonly CodeStyleOption<bool> onWithWarning = new CodeStyleOption<bool>(true, NotificationOption.Warning);
        private static readonly CodeStyleOption<bool> offWithWarning = new CodeStyleOption<bool>(false, NotificationOption.Warning);
        private static readonly CodeStyleOption<bool> onWithError = new CodeStyleOption<bool>(true, NotificationOption.Error);
        private static readonly CodeStyleOption<bool> offWithError = new CodeStyleOption<bool>(false, NotificationOption.Error);

        // specify all options explicitly to override defaults.
        public IDictionary<OptionKey, object> ImplicitTypeEverywhere() => OptionsSet(
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, onWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, onWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, onWithInfo));

        private IDictionary<OptionKey, object> ImplicitTypeWhereApparent() => OptionsSet(
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, offWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, onWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, offWithInfo));

        private IDictionary<OptionKey, object> ImplicitTypeWhereApparentAndForIntrinsics() => OptionsSet(
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, offWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, onWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, onWithInfo));

        public IDictionary<OptionKey, object> ImplicitTypeButKeepIntrinsics() => OptionsSet(
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, onWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, offWithInfo),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, onWithInfo));

        private IDictionary<OptionKey, object> ImplicitTypeEnforcements() => OptionsSet(
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, onWithWarning),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, onWithError),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, onWithInfo));

        private IDictionary<OptionKey, object> ImplicitTypeSilentEnforcement() => OptionsSet(
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, onWithSilent),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, onWithSilent),
            SingleOption(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, onWithSilent));

        private static IDictionary<OptionKey, object> Options(OptionKey option, object value)
            => new Dictionary<OptionKey, object> { { option, value } };

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnFieldDeclaration()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    [|int|] _myfield = 5;
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnFieldLikeEvents()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    public event [|D|] _myevent;
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnConstants()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        const [|int|] x = 5;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnNullLiteral()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Program|] x = null;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(27221, "https://github.com/dotnet/roslyn/issues/27221")]
        public async Task NotOnRefVar()
        {
            await TestMissingInRegularAndScriptAsync(@"
class Program
{
    void Method()
    {
        ref [|var|] x = Method2();
    }
    ref int Method2() => throw null;
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnDynamic()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|dynamic|] x = 1;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnAnonymousMethodExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Func<string, bool>|] comparer = delegate (string value) {
            return value != ""0"";
        };
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnLambdaExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Func<int, int>|] x = y => y * y;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnMethodGroup()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Func<string, string>|] copyStr = string.Copy;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnDeclarationWithMultipleDeclarators()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|int|] x = 5, y = x;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnDeclarationWithoutInitializer()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Program|] x;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnIFormattable()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|IFormattable|] s = $""Hello, {name}""
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnFormattableString()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|FormattableString|] s = $""Hello, {name}""
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotInCatchDeclaration()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        try
        {
        }
        catch ([|Exception|] e)
        {
            throw;
        }
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotDuringConflicts()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Program|] p = new Program();
    }

    class var
    {
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotIfAlreadyImplicitlyTyped()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] p = new Program();
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnImplicitConversion()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        int i = int.MaxValue;
        [|long|] l = i;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnBoxingImplicitConversion()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        int i = int.MaxValue;
        [|object|] o = i;
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnRHS()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    void M()
    {
        C c = new [|C|]();
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnVariablesUsedInInitalizerExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    void M()
    {
        [|int|] i = (i = 20);
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnAssignmentToInterfaceType()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    public void ProcessRead()
    {
        [|IInterface|] i = new A();
    }
}

class A : IInterface
{
}

interface IInterface
{
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task NotOnArrayInitializerWithoutNewKeyword()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|int[]|] n1 = {
            2,
            4,
            6,
            8
        };
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnLocalWithIntrinsicTypeString()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|string|] s = ""hello"";
    }
}",
@"using System;

class C
{
    static void M()
    {
        var s = ""hello"";
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnIntrinsicType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|int|] s = 5;
    }
}",
@"using System;

class C
{
    static void M()
    {
        var s = 5;
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(27221, "https://github.com/dotnet/roslyn/issues/27221")]
        public async Task SuggestVarOnRefIntrinsicType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        ref [|int|] s = Ref();
    }
    static ref int Ref() => throw null;
}",
@"using System;

class C
{
    static void M()
    {
        ref var s = Ref();
    }
    static ref int Ref() => throw null;
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(27221, "https://github.com/dotnet/roslyn/issues/27221")]
        public async Task WithRefIntrinsicTypeInForeach()
        {
            var before = @"
class E
{
    public ref int Current => throw null;
    public bool MoveNext() => throw null;
    public E GetEnumerator() => throw null;

    void M()
    {
        foreach (ref [|int|] x in this) { }
    }
}";
            var after = @"
class E
{
    public ref int Current => throw null;
    public bool MoveNext() => throw null;
    public E GetEnumerator() => throw null;

    void M()
    {
        foreach (ref var x in this) { }
    }
}";
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnFrameworkType()
        {
            await TestInRegularAndScriptAsync(
@"using System.Collections.Generic;

class C
{
    static void M()
    {
        [|List<int>|] c = new List<int>();
    }
}",
@"using System.Collections.Generic;

class C
{
    static void M()
    {
        var c = new List<int>();
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnUserDefinedType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    void M()
    {
        [|C|] c = new C();
    }
}",
@"using System;

class C
{
    void M()
    {
        var c = new C();
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnGenericType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C<T>
{
    static void M()
    {
        [|C<int>|] c = new C<int>();
    }
}",
@"using System;

class C<T>
{
    static void M()
    {
        var c = new C<int>();
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnSeeminglyConflictingType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class var<T>
{
    void M()
    {
        [|var<int>|] c = new var<int>();
    }
}",
@"using System;

class var<T>
{
    void M()
    {
        var c = new var<int>();
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnSingleDimensionalArrayTypeWithNewOperator()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|int[]|] n1 = new int[4] { 2, 4, 6, 8 };
    }
}",
@"using System;

class C
{
    static void M()
    {
        var n1 = new int[4] { 2, 4, 6, 8 };
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnSingleDimensionalArrayTypeWithNewOperator2()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|int[]|] n1 = new[] { 2, 4, 6, 8 };
    }
}",
@"using System;

class C
{
    static void M()
    {
        var n1 = new[] { 2, 4, 6, 8 };
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnSingleDimensionalJaggedArrayType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|int[][]|] cs = new[] {
            new[] { 1, 2, 3, 4 },
            new[] { 5, 6, 7, 8 }
        };
    }
}",
@"using System;

class C
{
    static void M()
    {
        var cs = new[] {
            new[] { 1, 2, 3, 4 },
            new[] { 5, 6, 7, 8 }
        };
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnDeclarationWithObjectInitializer()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|Customer|] cc = new Customer { City = ""Madras"" };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}",
@"using System;

class C
{
    static void M()
    {
        var cc = new Customer { City = ""Madras"" };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnDeclarationWithCollectionInitializer()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        [|List<int>|] digits = new List<int> { 1, 2, 3 };
    }
}",
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        var digits = new List<int> { 1, 2, 3 };
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnDeclarationWithCollectionAndObjectInitializers()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        [|List<Customer>|] cs = new List<Customer>
        {
            new Customer { City = ""Madras"" }
        };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}",
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        var cs = new List<Customer>
        {
            new Customer { City = ""Madras"" }
        };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnForStatement()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        for ([|int|] i = 0; i < 5; i++)
        {
        }
    }
}",
@"using System;

class C
{
    static void M()
    {
        for (var i = 0; i < 5; i++)
        {
        }
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnForeachStatement()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        var l = new List<int> { 1, 3, 5 };
        foreach ([|int|] item in l)
        {
        }
    }
}",
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        var l = new List<int> { 1, 3, 5 };
        foreach (var item in l)
        {
        }
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnQueryExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;

class C
{
    static void M()
    {
        var customers = new List<Customer>();
        [|IEnumerable<Customer>|] expr = from c in customers
                                     where c.City == ""London""
                                     select c;
    }

    private class Customer
    {
        public string City { get; set; }
    }
}
}",
@"using System;
using System.Collections.Generic;
using System.Linq;

class C
{
    static void M()
    {
        var customers = new List<Customer>();
        var expr = from c in customers
                                     where c.City == ""London""
                                     select c;
    }

    private class Customer
    {
        public string City { get; set; }
    }
}
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarInUsingStatement()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        using ([|Res|] r = new Res())
        {
        }
    }

    private class Res : IDisposable
    {
        public void Dispose()
        {
            throw new NotImplementedException();
        }
    }
}",
@"using System;

class C
{
    static void M()
    {
        using (var r = new Res())
        {
        }
    }

    private class Res : IDisposable
    {
        public void Dispose()
        {
            throw new NotImplementedException();
        }
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarOnExplicitConversion()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        double x = 1234.7;
        [|int|] a = (int)x;
    }
}",
@"using System;

class Program
{
    void Method()
    {
        double x = 1234.7;
        var a = (int)x;
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarInConditionalAccessExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        C obj = new C();
        [|C|] anotherObj = obj?.Test();
    }

    C Test()
    {
        return this;
    }
}",
@"using System;

class C
{
    static void M()
    {
        C obj = new C();
        var anotherObj = obj?.Test();
    }

    C Test()
    {
        return this;
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarInCheckedExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        long number1 = int.MaxValue + 20L;
        [|int|] intNumber = checked((int)number1);
    }
}",
@"using System;

class C
{
    static void M()
    {
        long number1 = int.MaxValue + 20L;
        var intNumber = checked((int)number1);
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarInUnCheckedExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        long number1 = int.MaxValue + 20L;
        [|int|] intNumber = unchecked((int)number1);
    }
}",
@"using System;

class C
{
    static void M()
    {
        long number1 = int.MaxValue + 20L;
        var intNumber = unchecked((int)number1);
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarInAwaitExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Threading.Tasks;

class C
{
    public async void ProcessRead()
    {
        [|string|] text = await ReadTextAsync(null);
    }

    private async Task<string> ReadTextAsync(string filePath)
    {
        return string.Empty;
    }
}",
@"using System;
using System.Threading.Tasks;

class C
{
    public async void ProcessRead()
    {
        var text = await ReadTextAsync(null);
    }

    private async Task<string> ReadTextAsync(string filePath)
    {
        return string.Empty;
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarInParenthesizedExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void ProcessRead()
    {
        [|int|] text = (5);
    }
}",
@"using System;

class C
{
    public void ProcessRead()
    {
        var text = (5);
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVarOnBuiltInType_Literal_WithOption()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|int|] s = 5;
    }
}", new TestParameters(options: ImplicitTypeButKeepIntrinsics()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVarOnBuiltInType_WithOption()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    private const int maxValue = int.MaxValue;

    static void M()
    {
        [|int|] s = (unchecked(maxValue + 10));
    }
}", new TestParameters(options: ImplicitTypeButKeepIntrinsics()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVarOnFrameworkTypeEquivalentToBuiltInType()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    private const int maxValue = int.MaxValue;

    static void M()
    {
        [|Int32|] s = (unchecked(maxValue + 10));
    }
}", new TestParameters(options: ImplicitTypeButKeepIntrinsics()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_DefaultExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        [|C|] text = default(C);
    }
}",
@"using System;

class C
{
    public void Process()
    {
        var text = default(C);
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_Literals()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        [|int|] text = 5;
    }
}",
@"using System;

class C
{
    public void Process()
    {
        var text = 5;
    }
}", options: ImplicitTypeWhereApparentAndForIntrinsics());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVarWhereTypeIsEvident_Literals()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        [|int|] text = 5;
    }
}", new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_ObjectCreationExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        [|C|] c = new C();
    }
}",
@"using System;

class C
{
    public void Process()
    {
        var c = new C();
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_CastExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        object o = DateTime.MaxValue;
        [|DateTime|] date = (DateTime)o;
    }
}",
@"using System;

class C
{
    public void Process()
    {
        object o = DateTime.MaxValue;
        var date = (DateTime)o;
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVar_BuiltInTypesRulePrecedesOverTypeIsApparentRule1()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        object o = int.MaxValue;
        [|int|] i = (Int32)o;
    }
}", new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVar_BuiltInTypesRulePrecedesOverTypeIsApparentRule2()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        object o = int.MaxValue;
        [|Int32|] i = (Int32)o;
    }
}", new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task DoNotSuggestVarWhereTypeIsEvident_IsExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        A a = new A();
        [|Boolean|] s = a is IInterface;
    }
}

class A : IInterface
{
}

interface IInterface
{
}", new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_AsExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        A a = new A();
        [|IInterface|] s = a as IInterface;
    }
}

class A : IInterface
{
}

interface IInterface
{
}",
@"using System;

class C
{
    public void Process()
    {
        A a = new A();
        var s = a as IInterface;
    }
}

class A : IInterface
{
}

interface IInterface
{
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_ConversionHelpers()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        [|DateTime|] a = DateTime.Parse(""1"");
    }
}",
@"using System;

class C
{
    public void Process()
    {
        var a = DateTime.Parse(""1"");
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_CreationHelpers()
        {
            await TestInRegularAndScriptAsync(
@"class C
{
    public void Process()
    {
        [|XElement|] a = XElement.Load();
    }
}

class XElement
{
    internal static XElement Load() => return null;
}",
@"class C
{
    public void Process()
    {
        var a = XElement.Load();
    }
}

class XElement
{
    internal static XElement Load() => return null;
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_CreationHelpersWithInferredTypeArguments()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        [|Tuple<int, bool>|] a = Tuple.Create(0, true);
    }
}",
@"using System;

class C
{
    public void Process()
    {
        var a = Tuple.Create(0, true);
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_ConvertToType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        int integralValue = 12534;
        [|DateTime|] date = Convert.ToDateTime(integralValue);
    }
}",
@"using System;

class C
{
    public void Process()
    {
        int integralValue = 12534;
        var date = Convert.ToDateTime(integralValue);
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarWhereTypeIsEvident_IConvertibleToType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void Process()
    {
        int codePoint = 1067;
        IConvertible iConv = codePoint;
        [|DateTime|] date = iConv.ToDateTime(null);
    }
}",
@"using System;

class C
{
    public void Process()
    {
        int codePoint = 1067;
        IConvertible iConv = codePoint;
        var date = iConv.ToDateTime(null);
    }
}", options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarNotificationLevelSilent()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|C|] n1 = new C();
    }
}";
            await TestMissingInRegularAndScriptAsync(source,
                new TestParameters(options: ImplicitTypeSilentEnforcement()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarNotificationLevelInfo()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|int|] s = 5;
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ImplicitTypeEnforcements(),
                diagnosticId: IDEDiagnosticIds.UseImplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Info);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarNotificationLevelWarning()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|C[]|] n1 = new[] { new C() }; // type not apparent and not intrinsic
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ImplicitTypeEnforcements(),
                diagnosticId: IDEDiagnosticIds.UseImplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Warning);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task SuggestVarNotificationLevelError()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|C|] n1 = new C();
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ImplicitTypeEnforcements(),
                diagnosticId: IDEDiagnosticIds.UseImplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Error);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(23893, "https://github.com/dotnet/roslyn/issues/23893")]
        public async Task SuggestVarOnLocalWithIntrinsicArrayType()
        {
            var before = @"class C { static void M() { [|int[]|] s = new int[0]; } }";
            var after = @"class C { static void M() { var s = new int[0]; } }";

            //The type is intrinsic and apparent
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeButKeepIntrinsics()));
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeWhereApparent())); // Preference of intrinsic types dominates
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(23893, "https://github.com/dotnet/roslyn/issues/23893")]
        public async Task SuggestVarOnLocalWithCustomArrayType()
        {
            var before = @"class C { static void M() { [|C[]|] s = new C[0]; } }";
            var after = @"class C { static void M() { var s = new C[0]; } }";

            //The type is not intrinsic but apparent
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeButKeepIntrinsics());
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(23893, "https://github.com/dotnet/roslyn/issues/23893")]
        public async Task SuggestVarOnLocalWithNonApparentCustomArrayType()
        {
            var before = @"class C { static void M() { [|C[]|] s = new[] { new C() }; } }";
            var after = @"class C { static void M() { var s = new[] { new C() }; } }";

            //The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeButKeepIntrinsics());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        private static string trivial2uple =
                    @"
namespace System
{
    public class ValueTuple
    {
        public static ValueTuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2) => new ValueTuple<T1, T2>(item1, item2);
    }
    public struct ValueTuple<T1, T2>
    {
        public T1 Item1;
        public T2 Item2;

        public ValueTuple(T1 item1, T2 item2) { }
    }
} ";

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(11094, "https://github.com/dotnet/roslyn/issues/11094")]
        public async Task SuggestVarOnLocalWithIntrinsicTypeTuple()
        {
            var before = @"class C { static void M() { [|(int a, string)|] s = (a: 1, ""hello""); } }";
            var after = @"class C { static void M() { var s = (a: 1, ""hello""); } }";

            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeWhereApparentAndForIntrinsics());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(11094, "https://github.com/dotnet/roslyn/issues/11094")]
        public async Task SuggestVarOnLocalWithNonApparentTupleType()
        {
            var before = @"class C { static void M(C c) { [|(int a, C b)|] s = (a: 1, b: c); } }";
            var after = @"class C { static void M(C c) { var s = (a: 1, b: c); } }";

            await TestInRegularAndScriptAsync(before, after, options: ImplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeWhereApparentAndForIntrinsics()));
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(11154, "https://github.com/dotnet/roslyn/issues/11154")]
        public async Task ValueTupleCreate()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|ValueTuple<int, int>|] s = ValueTuple.Create(1, 1);
    }
}" + trivial2uple,
@"using System;

class C
{
    static void M()
    {
        var s = ValueTuple.Create(1, 1);
    }
}" + trivial2uple,
options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(11095, "https://github.com/dotnet/roslyn/issues/11095")]
        public async Task ValueTupleCreate_2()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|(int, int)|] s = ValueTuple.Create(1, 1);
    }
}" + trivial2uple,
@"using System;

class C
{
    static void M()
    {
        var s = ValueTuple.Create(1, 1);
    }
}" + trivial2uple,
options: ImplicitTypeWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        public async Task TupleWithDifferentNames()
        {
            await TestMissingInRegularAndScriptAsync(
@"class C
{
    static void M()
    {
        [|(int, string)|] s = (c: 1, d: ""hello"");
    }
}",
new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(14052, "https://github.com/dotnet/roslyn/issues/14052")]
        public async Task DoNotOfferOnForEachConversionIfItChangesSemantics()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

interface IContractV1
{
}

interface IContractV2 : IContractV1
{
}

class ContractFactory
{
    public IEnumerable<IContractV1> GetContracts()
    {
    }
}

class Program
{
    static void M()
    {
        var contractFactory = new ContractFactory();
        foreach ([|IContractV2|] contract in contractFactory.GetContracts())
        {
        }
    }
}",
new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitType)]
        [WorkItem(14052, "https://github.com/dotnet/roslyn/issues/14052")]
        public async Task OfferOnForEachConversionIfItDoesNotChangesSemantics()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

interface IContractV1
{
}

interface IContractV2 : IContractV1
{
}

class ContractFactory
{
    public IEnumerable<IContractV1> GetContracts()
    {
    }
}

class Program
{
    static void M()
    {
        var contractFactory = new ContractFactory();
        foreach ([|IContractV1|] contract in contractFactory.GetContracts())
        {
        }
    }
}",
@"using System;
using System.Collections.Generic;

interface IContractV1
{
}

interface IContractV2 : IContractV1
{
}

class ContractFactory
{
    public IEnumerable<IContractV1> GetContracts()
    {
    }
}

class Program
{
    static void M()
    {
        var contractFactory = new ContractFactory();
        foreach (var contract in contractFactory.GetContracts())
        {
        }
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20437, "https://github.com/dotnet/roslyn/issues/20437")]
        public async Task SuggestVarOnDeclarationExpressionSyntax()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        DateTime.TryParse(string.Empty, [|out DateTime|] date);
    }
}",
@"using System;

class C
{
    static void M()
    {
        DateTime.TryParse(string.Empty, out var date);
    }
}",
options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23893, "https://github.com/dotnet/roslyn/issues/23893")]
        public async Task DoNotSuggestVarOnDeclarationExpressionSyntaxWithIntrinsicType()
        {
            var before =
@"class C
{
    static void M(out int x)
    {
        M([|out int|] x);
    }
}";
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ImplicitTypeButKeepIntrinsics()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task DoNotSuggestVarOnStackAllocExpressions_SpanType()
        {
            await TestMissingInRegularAndScriptAsync(@"
using System;
namespace System
{
    public readonly ref struct Span<T>
    {
        unsafe public Span(void* pointer, int length) { }
    }
}
class C
{
    static void M()
    {
        [|Span<int>|] x = stackalloc int [10];
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task DoNotSuggestVarOnStackAllocExpressions_SpanType_NestedConditional()
        {
            await TestMissingInRegularAndScriptAsync(@"
using System;
namespace System
{
    public readonly ref struct Span<T>
    {
        unsafe public Span(void* pointer, int length) { }
    }
}
class C
{
    static void M(bool choice)
    {
        [|Span<int>|] x = choice ? stackalloc int [10] : stackalloc int [100];
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task DoNotSuggestVarOnStackAllocExpressions_SpanType_NestedCast()
        {
            await TestMissingInRegularAndScriptAsync(@"
using System;
namespace System
{
    public readonly ref struct Span<T>
    {
        unsafe public Span(void* pointer, int length) { }
    }
}
class C
{
    static void M()
    {
        [|Span<int>|] x = (Span<int>)stackalloc int [100];
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task SuggestVarOnLambdasWithNestedStackAllocs()
        {
            await TestInRegularAndScriptAsync(@"
using System.Linq;
class C
{
    unsafe static void M()
    {
        [|int|] x = new int[] { 1, 2, 3 }.First(i =>
        {
            int* y = stackalloc int[10];
            return i == 1;
        });
    }
}", @"
using System.Linq;
class C
{
    unsafe static void M()
    {
        var x = new int[] { 1, 2, 3 }.First(i =>
        {
            int* y = stackalloc int[10];
            return i == 1;
        });
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task SuggestVarOnAnonymousMethodsWithNestedStackAllocs()
        {
            await TestInRegularAndScriptAsync(@"
using System.Linq;
class C
{
    unsafe static void M()
    {
        [|int|] x = new int[] { 1, 2, 3 }.First(delegate (int i)
        {
            int* y = stackalloc int[10];
            return i == 1;
        });
    }
}", @"
using System.Linq;
class C
{
    unsafe static void M()
    {
        var x = new int[] { 1, 2, 3 }.First(delegate (int i)
        {
            int* y = stackalloc int[10];
            return i == 1;
        });
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task SuggestVarOnStackAllocsNestedInLambdas()
        {
            await TestInRegularAndScriptAsync(@"
using System.Linq;
class C
{
    unsafe static void M()
    {
        var x = new int[] { 1, 2, 3 }.First(i =>
        {
            [|int*|] y = stackalloc int[10];
            return i == 1;
        });
    }
}", @"
using System.Linq;
class C
{
    unsafe static void M()
    {
        var x = new int[] { 1, 2, 3 }.First(i =>
        {
            var y = stackalloc int[10];
            return i == 1;
        });
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task SuggestVarOnStackAllocsNestedInAnonymousMethods()
        {
            await TestInRegularAndScriptAsync(@"
using System.Linq;
class C
{
    unsafe static void M()
    {
        var x = new int[] { 1, 2, 3 }.First(delegate (int i)
        {
            [|int*|] y = stackalloc int[10];
            return i == 1;
        });
    }
}", @"
using System.Linq;
class C
{
    unsafe static void M()
    {
        var x = new int[] { 1, 2, 3 }.First(delegate (int i)
        {
            var y = stackalloc int[10];
            return i == 1;
        });
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(22768, "https://github.com/dotnet/roslyn/issues/22768")]
        public async Task SuggestVarOnStackAllocsInOuterMethodScope()
        {
            await TestInRegularAndScriptAsync(@"
class C
{
    unsafe static void M()
    {
        [|int*|] x = stackalloc int [10];
    }
}", @"
class C
{
    unsafe static void M()
    {
        var x = stackalloc int [10];
    }
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23116, "https://github.com/dotnet/roslyn/issues/23116")]
        public async Task DoSuggestForDeclarationExpressionIfItWouldNotChangeOverloadResolution2()
        {
            await TestInRegularAndScriptAsync(@"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue(""key"", out [|int|] value);
        return value;
    }

    public static bool TryGetValue(string key, out int value) => false;
    public static bool TryGetValue(string key, out bool value, int x) => false;
}", @"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue(""key"", out var value);
        return value;
    }

    public static bool TryGetValue(string key, out int value) => false;
    public static bool TryGetValue(string key, out bool value, int x) => false;
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23116, "https://github.com/dotnet/roslyn/issues/23116")]
        public async Task DoNotSuggestForDeclarationExpressionIfItWouldChangeOverloadResolution()
        {
            await TestMissingInRegularAndScriptAsync(@"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue(""key"", out [|int|] value);
        return value;
    }

    public static bool TryGetValue(string key, out object value) => false;

    public static bool TryGetValue<T>(string key, out T value) => false;
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23116, "https://github.com/dotnet/roslyn/issues/23116")]
        public async Task DoNotSuggestIfChangesGenericTypeInference()
        {
            await TestMissingInRegularAndScriptAsync(@"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue(""key"", out [|int|] value);
        return value;
    }

    public static bool TryGetValue<T>(string key, out T value) => false;
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23116, "https://github.com/dotnet/roslyn/issues/23116")]
        public async Task SuggestIfDoesNotChangeGenericTypeInference1()
        {
            await TestInRegularAndScriptAsync(@"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue<int>(""key"", out [|int|] value);
        return value;
    }

    public static bool TryGetValue<T>(string key, out T value) => false;
}", @"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue<int>(""key"", out var value);
        return value;
    }

    public static bool TryGetValue<T>(string key, out T value) => false;
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23116, "https://github.com/dotnet/roslyn/issues/23116")]
        public async Task SuggestIfDoesNotChangeGenericTypeInference2()
        {
            await TestInRegularAndScriptAsync(@"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue(0, out [|int|] value);
        return value;
    }

    public static bool TryGetValue<T>(T key, out T value) => false;
}", @"
class Program
{
    static int Main(string[] args)
    {
        TryGetValue(0, out var value);
        return value;
    }

    public static bool TryGetValue<T>(T key, out T value) => false;
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23711, "https://github.com/dotnet/roslyn/issues/23711")]
        public async Task SuggestVarForDelegateType()
        {
            await TestInRegularAndScriptAsync(@"
class Program
{
    static void Main(string[] args)
    {
        [|GetHandler|] handler = Handler;
    }

    private static GetHandler Handler;

    delegate object GetHandler();
}", @"
class Program
{
    static void Main(string[] args)
    {
        var handler = Handler;
    }

    private static GetHandler Handler;

    delegate object GetHandler();
}", options: ImplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23711, "https://github.com/dotnet/roslyn/issues/23711")]
        public async Task DoNotSuggestVarForDelegateType1()
        {
            await TestMissingInRegularAndScriptAsync(@"
class Program
{
    static void Main(string[] args)
    {
        [|GetHandler|] handler = () => new object();
    }

    private static GetHandler Handler;

    delegate object GetHandler();
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23711, "https://github.com/dotnet/roslyn/issues/23711")]
        public async Task DoNotSuggestVarForDelegateType2()
        {
            await TestMissingInRegularAndScriptAsync(@"
class Program
{
    static void Main(string[] args)
    {
        [|GetHandler|] handler = Foo;
    }

    private static GetHandler Handler;

    private static object Foo() => new object();

    delegate object GetHandler();
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23711, "https://github.com/dotnet/roslyn/issues/23711")]
        public async Task DoNotSuggestVarForDelegateType3()
        {
            await TestMissingInRegularAndScriptAsync(@"
class Program
{
    static void Main(string[] args)
    {
        [|GetHandler|] handler = delegate { return new object(); };
    }

    private static GetHandler Handler;

    delegate object GetHandler();
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(24262, "https://github.com/dotnet/roslyn/issues/24262")]
        public async Task DoNotSuggestVarForInterfaceVariableInForeachStatement()
        {
            await TestMissingInRegularAndScriptAsync(@"
public interface ITest
{
    string Value { get; }
}
public class TestInstance : ITest
{
    string ITest.Value => ""Hi"";
}

public class Test
{
    public TestInstance[] Instances { get; }

    public void TestIt()
    {
        foreach ([|ITest|] test in Instances)
        {
            Console.WriteLine(test.Value);
        }
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(24262, "https://github.com/dotnet/roslyn/issues/24262")]
        public async Task DoNotSuggestVarForInterfaceVariableInDeclarationStatement()
        {
    await TestMissingInRegularAndScriptAsync(@"
public interface ITest
{
    string Value { get; }
}
public class TestInstance : ITest
{
    string ITest.Value => ""Hi"";
}

public class Test
{
    public void TestIt()
    {
        [|ITest|] test = new TestInstance();
        Console.WriteLine(test.Value);
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(24262, "https://github.com/dotnet/roslyn/issues/24262")]
        public async Task DoNotSuggestVarForAbstractClassVariableInForeachStatement()
        {
            await TestMissingInRegularAndScriptAsync(@"
public abstract class MyAbClass
{
    string Value { get; }
}

public class TestInstance : MyAbClass
{
    public string Value => ""Hi"";
}

public class Test
{
    public TestInstance[] Instances { get; }

    public void TestIt()
    {
        foreach ([|MyAbClass|] instance in Instances)
        {
            Console.WriteLine(instance);
        }
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(24262, "https://github.com/dotnet/roslyn/issues/24262")]
        public async Task DoNotSuggestVarForAbstractClassVariableInDeclarationStatement()
        {
            await TestMissingInRegularAndScriptAsync(@"
public abstract class MyAbClass
{
    string Value { get; }
}

public class TestInstance : MyAbClass
{
    public string Value => ""Hi"";
}

public class Test
{
    public TestInstance[] Instances { get; }

    public void TestIt()
    {
        [|MyAbClass|]  test = new TestInstance();
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [Fact]
        public async Task DoNoSuggestVarForRefForeachVar()
        {
            await TestMissingInRegularAndScriptAsync(@"
using System;
namespace System
{
    public readonly ref struct Span<T>
    {
        unsafe public Span(void* pointer, int length) { }

        public ref SpanEnum GetEnumerator() => throw new Exception();

        public struct SpanEnum
        {
            public ref int Current => 0;
            public bool MoveNext() => false;
        }
    }
}
class C
{
    public void M(Span<int> span)
    {
        foreach ([|ref|] var rx in span)
        {
        }
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }

        [Fact, WorkItem(26923, "https://github.com/dotnet/roslyn/issues/26923")]
        public async Task NoSuggestionOnForeachCollectionExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void Main(string[] args)
    {
        foreach (string arg in [|args|])
        {

        }
    }
}", new TestParameters(options: ImplicitTypeEverywhere()));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace TerrificNet.ViewEngine.IO
{
    public class PathInfo : IEquatable<PathInfo>
    {
        public readonly static PathInfo Empty = new PathInfo(string.Empty);

        private IEnumerable<string> _enumerator;
        private string _unverifiedPath;
        private string _normalizedPath;
        private string[] _parts;

        private PathInfo(string unverifiedPath)
        {
            _unverifiedPath = unverifiedPath;
        }

        private PathInfo(string[] parts)
        {
            _parts = parts;
        }

        private PathInfo(IEnumerable<string> enumerator)
        {
            _enumerator = enumerator;
        }

        public PathInfo DirectoryName
        {
            get { return new PathInfo(GetEnumerateReverse().Skip(1)); }
        }

        public PathInfo Name
        {
            get { return new PathInfo(GetEnumerateReverse().Take(1)); }
        }

        public static PathInfo Create(string path)
        {
            return new PathInfo(path);
        }

        public override string ToString()
        {
            return VerifiedPath();
        }

        private string VerifiedPath()
        {
            if (_normalizedPath == null)
            {
                var parts = GetParts();
                _normalizedPath = string.Join("/", parts);
                _unverifiedPath = null;
            }

            return _normalizedPath;
        }

        private string[] GetParts()
        {
            if (_parts == null)
                _parts = VerifyRoot(Normalize(GetEnumerateReverse()).Reverse()).ToArray();

            return _parts;
        }

        private IEnumerable<string> VerifyRoot(IEnumerable<string> reverse)
        {
            bool isFirstRun = true;
            foreach (var val in reverse)
            {
                if (!isFirstRun && string.IsNullOrEmpty(val))
                    throw new ArgumentException("Can not combine root paths");

                isFirstRun = false;
                yield return val;
            }
        }

        private static IEnumerable<string> Normalize(IEnumerable<string> strings)
        {
            int skip = 0;
            foreach (var val in strings)
            {
                if ("..".Equals(val, StringComparison.Ordinal))
                    skip++;
                else if (".".Equals(val, StringComparison.Ordinal))
                    continue;
                else if (skip > 0)
                    skip--;
                else
                    yield return val;
            }

            for (int i = 0; i < skip; i++)
            {
                yield return "..";
            }
        }

        private IEnumerable<string> GetEnumerateReverse()
        {
            if (_enumerator == null)
                _enumerator = EnumerateReverse();

            if (_parts != null)
                return _parts.Reverse();

            return _enumerator;
        }

        private IEnumerable<string> EnumerateReverse()
        {
            var path = _normalizedPath ?? _unverifiedPath;

            return EnumerateReverse(path, 0);
        }

        private static IEnumerable<string> EnumerateReverse(string path, int skip)
        {
            if (string.IsNullOrEmpty(path))
                yield break;

            var strings = path.Split('\\', '/');
            for (int i = strings.Length - 1; i >= skip; i--)
            {
                var val = strings[i];
                if (string.IsNullOrEmpty(val))
                {
                    if (i == 0)
                    {
                        yield return string.Empty;
                        continue;
                    }

                    if (i == strings.Length - 1)
                        continue;

                    throw new ArgumentException("Duplicated path seperator");
                }

                yield return val;
            }
        }

        public PathInfo RemoveStartSlash()
        {
            var parts = GetParts();
            if (string.IsNullOrEmpty(parts[0]))
                return new PathInfo(parts.Skip(1).ToArray());

            return this;
        }

        public bool StartsWith(PathInfo directory)
        {
            return this.ToString().StartsWith(directory.ToString(), StringComparison.OrdinalIgnoreCase);
        }

        public bool HasExtension(string fileExtension)
        {
            return this.ToString().EndsWith(fileExtension, StringComparison.OrdinalIgnoreCase);
        }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            if (ReferenceEquals(this, obj))
                return true;

            var p = obj as PathInfo;
            if (p != null)
                return this.Equals(p);

            return false;
        }

        public virtual bool Equals(PathInfo other)
        {
            return ToString().Equals(other.ToString());
        }

        public override int GetHashCode()
        {
            return ToString().GetHashCode();
        }

        public static PathInfo Combine(params PathInfo[] parts)
        {
            return new PathInfo(parts.Where(p => p != null).Reverse().SelectMany(p => p.GetEnumerateReverse()));
        }

        public static PathInfo GetSubPath(PathInfo basePath, string fullPath)
        {
            if (basePath == null)
                return Create(fullPath);

            return new PathInfo(EnumerateReverse(fullPath, basePath.GetParts().Length));
        }
    }
}


text:
//mocha.bail();
//mocha.run();

var expect = chai.expect;
var assert = chai.assert;
var should = chai.should;

// Test timeouts
var testTimeout = 35000;

// Get User Media timeout
var gUMTimeout = 25000;

// Test item timeout
var testItemTimeout = 4000;

describe('MediaStreamError', function() {
	this.timeout(testTimeout);

	/* WebRTC Object should be initialized in Safari/IE Plugin */
  before(function (done) {
    this.timeout(testItemTimeout);

	AdapterJS.webRTCReady(function() {
		done();
	});
  });

	it('MediaStreamError.name === "NotSupportedError" < When > MediaStreamConstraints === {}', function (done) {
		this.timeout(testItemTimeout);

		try {
			window.getUserMedia({}, function (stream) {
				throw new Error('Invalid constraints passed still triggers a success callback');

			}, function (error) {
				throw error;
			});
		} catch (error) {
			expect(error.name).to.equal('NotSupportedError');
		}
	});

	it('MediaStreamError.name === "NotSupportedError" < When > MediaStreamConstraints === { doesnotexist: true }', function (done) {
		this.timeout(testItemTimeout + gUMTimeout);

		var isInvoked = false;

		try {
			window.getUserMedia({
				doesnotexist: true

			}, function (stream) {
				isInvoked = true;
				throw new Error('Stream should not be retrieved');

			}, function (error) {
				isInvoked = true;
				throw error;
			});
		} catch (error) {
			expect(error.name).to.equal('NotSupportedError');
		}
	});

	it.skip('MediaStreamError.name === "PermissionDeniedError"', function () {});

	it('MediaStreamError.name === "ConstraintNotSatisfiedError"', function (done) {
		this.timeout(testItemTimeout);

		window.getUserMedia({
			video: {
				minWidth: Infinity
			}
		}, function (stream) {
			throw new Error('Invalid constraints passed still triggers a success callback');

		}, function (error) {
			expect(error.name).to.equal('ConstraintNotSatisfiedError');
	    	expect(error.constraintName).to.equal('minWidth');
	    	done();
		});
	});

	it.skip('MediaStreamError.name === "OverconstrainedError"', function () {});

	it.skip('MediaStreamError.name === "NotFoundError"', function () {});

	it.skip('MediaStreamError.name === "AbortError"', function () {});

	it.skip('MediaStreamError.name === "SourceUnavailableError"', function () {});

});