text:
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace FluentAssertions.Analyzers.Tests.Tips
{
    [TestClass]
    public class MsTestTests
    {
        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace1_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks;")
            .AppendLine("namespace Microsoft.VisualStudio.TestTools")
            .AppendLine("{")
            .AppendLine("    using UnitTesting;")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace2_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks;")
            .AppendLine("namespace Microsoft.VisualStudio")
            .AppendLine("{")
            .AppendLine("    using TestTools.UnitTesting;")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace3_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks;")
            .AppendLine("namespace Microsoft")
            .AppendLine("{ namespace VisualStudio {")
            .AppendLine("    using TestTools.UnitTesting;")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }}")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace4_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks;")
            .AppendLine("namespace Microsoft")
            .AppendLine("{ namespace VisualStudio {")
            .AppendLine("    using TestTools   .   UnitTesting;")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }}")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace5_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks;")
            .AppendLine("using Microsoft . VisualStudio . TestTools . UnitTesting;")
            .AppendLine("namespace Testing")
            .AppendLine("{")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace6_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks; using static Microsoft.VisualStudio.TestTools.UnitTesting.Assert;")
            .AppendLine("using Microsoft . VisualStudio . TestTools . UnitTesting;")
            .AppendLine("namespace Testing")
            .AppendLine("{")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace7_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks; using MsAssert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;")
            .AppendLine("using Microsoft . VisualStudio . TestTools . UnitTesting;")
            .AppendLine("namespace Testing")
            .AppendLine("{")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsTrue(actual{0});")]
        [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsTrue_NestedUsingInNamespace8_TestAnalyzer(string assertion)
            => VerifyCSharpDiagnostic<AssertIsTrueAnalyzer>("bool actual", assertion, new StringBuilder()
            .AppendLine("using System;")
            .AppendLine("using FluentAssertions;")
            .AppendLine("using FluentAssertions.Extensions;")
            .AppendLine("using System.Threading.Tasks;")
            .AppendLine("namespace Testing")
            .AppendLine("{")
            .AppendLine("    using Microsoft.VisualStudio.TestTools.UnitTesting;")
            .AppendLine("    class TestClass")
            .AppendLine("    {")
            .AppendLine($"        void TestMethod(bool actual)")
            .AppendLine("        {")
            .AppendLine($"            {assertion}")
            .AppendLine("        }")
            .AppendLine("    }")
            .AppendMainMethod()
            .AppendLine("}")
            .ToString());

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsTrue(actual{0});",
            newAssertion: "actual.Should().BeTrue({0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsTrue(bool.Parse(\"true\"){0});",
            newAssertion: "bool.Parse(\"true\").Should().BeTrue({0});")]
        [Implemented]
        public void AssertIsTrue_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertIsTrueCodeFix, AssertIsTrueAnalyzer>("bool actual", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsFalse(actual{0});")]
        [AssertionDiagnostic("Assert.IsFalse(bool.Parse(\"true\"){0});")]
        [Implemented]
        public void AssertIsFalse_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertIsFalseAnalyzer>("bool actual", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsFalse(actual{0});",
            newAssertion: "actual.Should().BeFalse({0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsFalse(bool.Parse(\"true\"){0});",
            newAssertion: "bool.Parse(\"true\").Should().BeFalse({0});")]
        [Implemented]
        public void AssertIsFalse_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertIsFalseCodeFix, AssertIsFalseAnalyzer>("bool actual", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsNull(actual{0});")]
        [Implemented]
        public void AssertIsNull_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertIsNullAnalyzer>("object actual", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsNull(actual{0});",
            newAssertion: "actual.Should().BeNull({0});")]
        [Implemented]
        public void AssertIsNull_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertIsNullCodeFix, AssertIsNullAnalyzer>("object actual", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsNotNull(actual{0});")]
        [Implemented]
        public void AssertIsNotNull_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertIsNotNullAnalyzer>("object actual", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsNotNull(actual{0});",
            newAssertion: "actual.Should().NotBeNull({0});")]
        [Implemented]
        public void AssertIsNotNull_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertIsNotNullCodeFix, AssertIsNotNullAnalyzer>("object actual", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsInstanceOfType(actual, type{0});")]
        [AssertionDiagnostic("Assert.IsInstanceOfType(actual, typeof(string){0});")]
        [Implemented]
        public void AssertIsInstanceOfType_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertIsInstanceOfTypeAnalyzer>("object actual, Type type", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsInstanceOfType(actual, type{0});",
            newAssertion: "actual.Should().BeOfType(type{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsInstanceOfType(actual, typeof(string){0});",
            newAssertion: "actual.Should().BeOfType<string>({0});")]
        [Implemented]
        public void AssertIsInstanceOfType_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertIsInstanceOfTypeCodeFix, AssertIsInstanceOfTypeAnalyzer>("object actual, Type type", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.IsNotInstanceOfType(actual, type{0});")]
        [AssertionDiagnostic("Assert.IsNotInstanceOfType(actual, typeof(string){0});")]
        [Implemented]
        public void AssertIsNotInstanceOfType_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertIsNotInstanceOfTypeAnalyzer>("object actual, Type type", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsNotInstanceOfType(actual, type{0});",
            newAssertion: "actual.Should().NotBeOfType(type{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.IsNotInstanceOfType(actual, typeof(string){0});",
            newAssertion: "actual.Should().NotBeOfType<string>({0});")]
        [Implemented]
        public void AssertIsNotInstanceOfType_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertIsNotInstanceOfTypeCodeFix, AssertIsNotInstanceOfTypeAnalyzer>("object actual, Type type", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual{0});")]
        [Implemented]
        public void AssertObjectAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreEqualAnalyzer>("object actual, object expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual{0});",
            newAssertion: "actual.Should().Be(expected{0});")]
        [Implemented]
        public void AssertObjectAreEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreEqualCodeFix, AssertAreEqualAnalyzer>("object actual, object expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, delta{0});")]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, 0.6{0});")]
        [Implemented]
        public void AssertDoubleAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreEqualAnalyzer>("double actual, double expected, double delta", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, delta{0});",
            newAssertion: "actual.Should().BeApproximately(expected, delta{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, 0.6{0});",
            newAssertion: "actual.Should().BeApproximately(expected, 0.6{0});")]
        [Implemented]
        public void AssertDoubleAreEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreEqualCodeFix, AssertAreEqualAnalyzer>("double actual, double expected, double delta", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, delta{0});")]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, 0.6f{0});")]
        [Implemented]
        public void AssertFloatAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreEqualAnalyzer>("float actual, float expected, float delta", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, delta{0});",
            newAssertion: "actual.Should().BeApproximately(expected, delta{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, 0.6f{0});",
            newAssertion: "actual.Should().BeApproximately(expected, 0.6f{0});")]
        [Implemented]
        public void AssertFloatAreEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreEqualCodeFix, AssertAreEqualAnalyzer>("float actual, float expected, float delta", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual{0});")]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, false{0});")]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, true{0});")]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, false, System.Globalization.CultureInfo.CurrentCulture{0});")]
        [AssertionDiagnostic("Assert.AreEqual(expected, actual, true, System.Globalization.CultureInfo.CurrentCulture{0});")]
        [Implemented]
        public void AssertStringAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreEqualAnalyzer>("string actual, string expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual{0});",
            newAssertion: "actual.Should().Be(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, false{0});",
            newAssertion: "actual.Should().Be(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, true{0});",
            newAssertion: "actual.Should().BeEquivalentTo(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, false, System.Globalization.CultureInfo.CurrentCulture{0});",
            newAssertion: "actual.Should().Be(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreEqual(expected, actual, true, System.Globalization.CultureInfo.CurrentCulture{0});",
            newAssertion: "actual.Should().BeEquivalentTo(expected{0});")]
        [Implemented]
        public void AssertStringAreEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreEqualCodeFix, AssertAreEqualAnalyzer>("string actual, string expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual{0});")]
        [Implemented]
        public void AssertObjectAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreNotEqualAnalyzer>("object actual, object expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual{0});",
            newAssertion: "actual.Should().NotBe(expected{0});")]
        [Implemented]
        public void AssertObjectAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreNotEqualCodeFix, AssertAreNotEqualAnalyzer>("object actual, object expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, delta{0});")]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, 0.6{0});")]
        [Implemented]
        public void AssertDoubleAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreNotEqualAnalyzer>("double actual, double expected, double delta", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, delta{0});",
            newAssertion: "actual.Should().NotBeApproximately(expected, delta{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, 0.6{0});",
            newAssertion: "actual.Should().NotBeApproximately(expected, 0.6{0});")]
        [Implemented]
        public void AssertDoubleAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreNotEqualCodeFix, AssertAreNotEqualAnalyzer>("double actual, double expected, double delta", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, delta{0});")]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, 0.6f{0});")]
        [Implemented]
        public void AssertFloatAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreNotEqualAnalyzer>("float actual, float expected, float delta", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, delta{0});",
            newAssertion: "actual.Should().NotBeApproximately(expected, delta{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, 0.6f{0});",
            newAssertion: "actual.Should().NotBeApproximately(expected, 0.6f{0});")]
        [Implemented]
        public void AssertFloatAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreNotEqualCodeFix, AssertAreNotEqualAnalyzer>("float actual, float expected, float delta", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual{0});")]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, false{0});")]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, true{0});")]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, false, System.Globalization.CultureInfo.CurrentCulture{0});")]
        [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, true, System.Globalization.CultureInfo.CurrentCulture{0});")]
        [Implemented]
        public void AssertStringAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreNotEqualAnalyzer>("string actual, string expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual{0});",
            newAssertion: "actual.Should().NotBe(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, false{0});",
            newAssertion: "actual.Should().NotBe(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, true{0});",
            newAssertion: "actual.Should().NotBeEquivalentTo(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, false, System.Globalization.CultureInfo.CurrentCulture{0});",
            newAssertion: "actual.Should().NotBe(expected{0});")]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotEqual(expected, actual, true, System.Globalization.CultureInfo.CurrentCulture{0});",
            newAssertion: "actual.Should().NotBeEquivalentTo(expected{0});")]
        [Implemented]
        public void AssertStringAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreNotEqualCodeFix, AssertAreNotEqualAnalyzer>("string actual, string expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreSame(expected, actual{0});")]
        [Implemented]
        public void AssertAreSame_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreSameAnalyzer>("object actual, object expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreSame(expected, actual{0});",
            newAssertion: "actual.Should().BeSameAs(expected{0});")]
        [Implemented]
        public void AssertAreSame_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreSameCodeFix, AssertAreSameAnalyzer>("object actual, object expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.AreNotSame(expected, actual{0});")]
        [Implemented]
        public void AssertAreNotSame_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertAreNotSameAnalyzer>("object actual, object expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.AreNotSame(expected, actual{0});",
            newAssertion: "actual.Should().NotBeSameAs(expected{0});")]
        [Implemented]
        public void AssertAreNotSame_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertAreNotSameCodeFix, AssertAreNotSameAnalyzer>("object actual, object expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.ThrowsException<ArgumentException>(action{0});")]
        [Implemented]
        public void AssertThrowsException_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertThrowsExceptionAnalyzer>("Action action", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.ThrowsException<ArgumentException>(action{0});",
            newAssertion: "action.Should().ThrowExactly<ArgumentException>({0});")]
        [Implemented]
        public void AssertThrowsException_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertThrowsExceptionCodeFix, AssertThrowsExceptionAnalyzer>("Action action", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("Assert.ThrowsExceptionAsync<ArgumentException>(action{0});")]
        [Implemented]
        public void AssertThrowsExceptionAsync_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<AssertThrowsExceptionAsyncAnalyzer>("Func<Task> action", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "Assert.ThrowsExceptionAsync<ArgumentException>(action{0});",
            newAssertion: "action.Should().ThrowExactlyAsync<ArgumentException>({0});")]
        [Implemented]
        public void AssertThrowsExceptionAsync_TestCodeFix(string oldAssertion, string newAssertion)
            => VerifyCSharpFix<AssertThrowsExceptionAsyncCodeFix, AssertThrowsExceptionAsyncAnalyzer>("Func<Task> action", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, type{0});")]
        [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(int){0});")]
        [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(Int32){0});")]
        [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(System.Int32){0});")]
        [Implemented]
        public void CollectionAssertAllItemsAreInstancesOfType_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAllItemsAreInstancesOfTypeAnalyzer>("System.Collections.Generic.List<int> actual, Type type", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AllItemsAreInstancesOfType(actual, type{0});",
            newAssertion: "actual.Should().AllBeOfType(type{0});")]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(int){0});",
            newAssertion: "actual.Should().AllBeOfType<int>({0});")]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(Int32){0});",
            newAssertion: "actual.Should().AllBeOfType<Int32>({0});")]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(System.Int32){0});",
            newAssertion: "actual.Should().AllBeOfType<System.Int32>({0});")]
        [Implemented]
        public void CollectionAssertAllItemsAreInstancesOfType_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAllItemsAreInstancesOfTypeCodeFix, CollectionAssertAllItemsAreInstancesOfTypeAnalyzer>("System.Collections.Generic.List<int> actual, Type type", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AreEqual(expected, actual{0});")]
        [Implemented]
        public void CollectionAssertAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAreEqualAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AreEqual(expected, actual{0});",
            newAssertion: "actual.Should().Equal(expected{0});")]
        [Implemented]
        public void CollectionAssertAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAreEqualCodeFix, CollectionAssertAreEqualAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AreNotEqual(expected, actual{0});")]
        [Implemented]
        public void CollectionAssertAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAreNotEqualAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AreNotEqual(expected, actual{0});",
            newAssertion: "actual.Should().NotEqual(expected{0});")]
        [Implemented]
        public void CollectionAssertAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAreNotEqualCodeFix, CollectionAssertAreNotEqualAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AreEquivalent(expected, actual{0});")]
        [Implemented]
        public void CollectionAssertAreEquivalent_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAreEquivalentAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AreEquivalent(expected, actual{0});",
            newAssertion: "actual.Should().BeEquivalentTo(expected{0});")]
        [Implemented]
        public void CollectionAssertAreEquivalent_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAreEquivalentCodeFix, CollectionAssertAreEquivalentAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AreNotEquivalent(expected, actual{0});")]
        [Implemented]
        public void CollectionAssertAreNotEquivalent_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAreNotEquivalentAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AreNotEquivalent(expected, actual{0});",
            newAssertion: "actual.Should().NotBeEquivalentTo(expected{0});")]
        [Implemented]
        public void CollectionAssertAreNotEquivalent_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAreNotEquivalentCodeFix, CollectionAssertAreNotEquivalentAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AllItemsAreNotNull(actual{0});")]
        [Implemented]
        public void CollectionAssertAllItemsAreNotNull_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAllItemsAreNotNullAnalyzer>("System.Collections.Generic.List<int> actual", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AllItemsAreNotNull(actual{0});",
            newAssertion: "actual.Should().NotContainNulls({0});")]
        [Implemented]
        public void CollectionAssertAllItemsAreNotNull_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAllItemsAreNotNullCodeFix, CollectionAssertAllItemsAreNotNullAnalyzer>("System.Collections.Generic.List<int> actual", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.AllItemsAreUnique(actual{0});")]
        [Implemented]
        public void CollectionAssertAllItemsAreUnique_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertAllItemsAreUniqueAnalyzer>("System.Collections.Generic.List<int> actual", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.AllItemsAreUnique(actual{0});",
            newAssertion: "actual.Should().OnlyHaveUniqueItems({0});")]
        [Implemented]
        public void CollectionAssertAllItemsAreUnique_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertAllItemsAreUniqueCodeFix, CollectionAssertAllItemsAreUniqueAnalyzer>("System.Collections.Generic.List<int> actual", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.Contains(actual, expected{0});")]
        [Implemented]
        public void CollectionAssertContains_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertContainsAnalyzer>("System.Collections.Generic.List<int> actual, int expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.Contains(actual, expected{0});",
            newAssertion: "actual.Should().Contain(expected{0});")]
        [Implemented]
        public void CollectionAssertContains_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertContainsCodeFix, CollectionAssertContainsAnalyzer>("System.Collections.Generic.List<int> actual, int expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.DoesNotContain(actual, expected{0});")]
        [Implemented]
        public void CollectionAssertDoesNotContain_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertDoesNotContainAnalyzer>("System.Collections.Generic.List<int> actual, int expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.DoesNotContain(actual, expected{0});",
            newAssertion: "actual.Should().NotContain(expected{0});")]
        [Implemented]
        public void CollectionAssertDoesNotContain_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertDoesNotContainCodeFix, CollectionAssertDoesNotContainAnalyzer>("System.Collections.Generic.List<int> actual, int expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.IsSubsetOf(expected, actual{0});")]
        [Implemented]
        public void CollectionAssertIsSubsetOf_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertIsSubsetOfAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.IsSubsetOf(expected, actual{0});",
            newAssertion: "actual.Should().BeSubsetOf(expected{0});")]
        [Implemented]
        public void CollectionAssertIsSubsetOf_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertIsSubsetOfCodeFix, CollectionAssertIsSubsetOfAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("CollectionAssert.IsNotSubsetOf(expected, actual{0});")]
        [Implemented]
        public void CollectionAssertIsNotSubsetOf_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<CollectionAssertIsNotSubsetOfAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "CollectionAssert.IsNotSubsetOf(expected, actual{0});",
            newAssertion: "actual.Should().NotBeSubsetOf(expected{0});")]
        [Implemented]
        public void CollectionAssertIsNotSubsetOf_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<CollectionAssertIsNotSubsetOfCodeFix, CollectionAssertIsNotSubsetOfAnalyzer>("System.Collections.Generic.List<int> actual, System.Collections.Generic.List<int> expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("StringAssert.Contains(expected, actual{0});")]
        [Implemented]
        public void StringAssertContains_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<StringAssertContainsAnalyzer>("string actual, string expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "StringAssert.Contains(expected, actual{0});",
            newAssertion: "actual.Should().Contain(expected{0});")]
        [Implemented]
        public void StringAssertContains_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<StringAssertContainsCodeFix, StringAssertContainsAnalyzer>("string actual, string expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("StringAssert.StartsWith(expected, actual{0});")]
        [Implemented]
        public void StringAssertStartsWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<StringAssertStartsWithAnalyzer>("string actual, string expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "StringAssert.StartsWith(expected, actual{0});",
            newAssertion: "actual.Should().StartWith(expected{0});")]
        [Implemented]
        public void StringAssertStartsWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<StringAssertStartsWithCodeFix, StringAssertStartsWithAnalyzer>("string actual, string expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("StringAssert.EndsWith(expected, actual{0});")]
        [Implemented]
        public void StringAssertEndsWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<StringAssertEndsWithAnalyzer>("string actual, string expected", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "StringAssert.EndsWith(expected, actual{0});",
            newAssertion: "actual.Should().EndWith(expected{0});")]
        [Implemented]
        public void StringAssertEndsWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<StringAssertEndsWithCodeFix, StringAssertEndsWithAnalyzer>("string actual, string expected", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("StringAssert.Matches(actual, pattern{0});")]
        [Implemented]
        public void StringAssertMatches_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<StringAssertMatchesAnalyzer>("string actual, System.Text.RegularExpressions.Regex pattern", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "StringAssert.Matches(actual, pattern{0});",
            newAssertion: "actual.Should().MatchRegex(pattern{0});")]
        [Implemented]
        public void StringAssertMatches_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<StringAssertMatchesCodeFix, StringAssertMatchesAnalyzer>("string actual, System.Text.RegularExpressions.Regex pattern", oldAssertion, newAssertion);

        [AssertionDataTestMethod]
        [AssertionDiagnostic("StringAssert.DoesNotMatch(actual, pattern{0});")]
        [Implemented]
        public void StringAssertDoesNotMatch_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic<StringAssertDoesNotMatchAnalyzer>("string actual, System.Text.RegularExpressions.Regex pattern", assertion);

        [AssertionDataTestMethod]
        [AssertionCodeFix(
            oldAssertion: "StringAssert.DoesNotMatch(actual, pattern{0});",
            newAssertion: "actual.Should().NotMatchRegex(pattern{0});")]
        [Implemented]
        public void StringAssertDoesNotMatch_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix<StringAssertDoesNotMatchCodeFix, StringAssertDoesNotMatchAnalyzer>("string actual, System.Text.RegularExpressions.Regex pattern", oldAssertion, newAssertion);

        private void VerifyCSharpDiagnostic<TDiagnosticAnalyzer>(string methodArguments, string assertion, string source) where TDiagnosticAnalyzer : Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, new()
        {
            var type = typeof(TDiagnosticAnalyzer);
            var diagnosticId = (string)type.GetField("DiagnosticId").GetValue(null);
            var message = (string)type.GetField("Message").GetValue(null);

            DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source, new DiagnosticResult
            {
                Id = diagnosticId,
                Message = message,
                Locations = new DiagnosticResultLocation[]
                {
                    new DiagnosticResultLocation("Test0.cs", 12, 13)
                },
                Severity = DiagnosticSeverity.Info
            });
        }
        private void VerifyCSharpDiagnostic<TDiagnosticAnalyzer>(string methodArguments, string assertion) where TDiagnosticAnalyzer : Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, new()
            => VerifyCSharpDiagnostic<TDiagnosticAnalyzer>(methodArguments, assertion, GenerateCode.MsTestAssertion(methodArguments, assertion));

        private void VerifyCSharpFix<TCodeFixProvider, TDiagnosticAnalyzer>(string methodArguments, string oldAssertion, string newAssertion)
            where TCodeFixProvider : Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider, new()
            where TDiagnosticAnalyzer : Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, new()
        {
            var oldSource = GenerateCode.MsTestAssertion(methodArguments, oldAssertion);
            var newSource = GenerateCode.MsTestAssertion(methodArguments, newAssertion);

            DiagnosticVerifier.VerifyCSharpFix<TCodeFixProvider, TDiagnosticAnalyzer>(oldSource, newSource);
        }
    }
}


text:
$jsnbt is an easy one.

It just injects to your controllers the jsnbt.js object configuration as we described in previous chapters.

redpajama_set_name: RedPajamaGithub


text:
package com.gansuer.algorithms.graphs.spanningtree;

import com.gansuer.common.util.FileUtils;
import com.gansuer.common.util.StringUtils;

import java.util.List;

/**
 * Created by Frank on 7/7/16.
 */
public class EWGTestBase {

    protected EdgeWeightGraph graph;
    protected int v;
    protected int e;
    protected String tiny = "graph/tinyEWG.txt";
    protected String medium = "graph/mediumEWG.txt";

    public void init(boolean isMedium) throws Exception {
        List<String> lines = FileUtils.readFile(this.getClass().getClassLoader().getResource
                (!isMedium ? tiny : medium).getFile());
        v = Integer.parseInt(lines.get(0).trim());
        e = Integer.parseInt(lines.get(1).trim());

        graph = new EdgeWeightGraph(v);
        for (int i = 2; i < lines.size(); i++) {
            String[] strs = StringUtils.replaceAllEmptyCharWith(lines.get(i).trim(), " ").split(" ");
            graph.addEdge(new Edge(Integer.parseInt(strs[0]), Integer.parseInt(strs[1]),
                    Double.parseDouble(strs[2])));

        }
        System.out.println(graph);
        System.out.println("--------------graph end------------");
    }
}


text:
package com.intel.media.mts.action.execution;

import java.util.List;

import org.junit.Assert;
import org.junit.Test;

import com.intel.media.mts.action.ActionTestSupport;
import com.intel.media.mts.model.Execution;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionProxy;

public class ListExecutionActionTest extends
		ActionTestSupport<ListExecutionAction> {
	private String actionName = "/listExecutionAction";

	@Test
	public void testListExecutionAction(){
		setActionName(actionName);
		ActionProxy proxy = this.getProxy();
		Assert.assertNotNull(proxy);

		ListExecutionAction action = this.getAction();
		Assert.assertNotNull(action);

		try {
			String result = proxy.execute();
			Assert.assertEquals(Action.SUCCESS, result);
			List<Execution> executions = action.getExecutions();
			for(Execution e : executions){
				System.out.println(e.logInfo());
			}
		} catch (Exception e) {
			e.printStackTrace();
			Assert.fail("ListExecutionAction");
		}
	}
}


text:
<?xml version="1.0"?>
<Orchard>
  <Recipe>
    <Name>AutorouteLists</Name>
    <Description>Adds Autoroute functionality to an existing blog</Description>
    <Author>The Orchard Team</Author>
    <WebSite>http://orchardproject.net</WebSite>
    <Tags>container, autoroute</Tags>
    <Version>1.0</Version>
  </Recipe>

  <Feature enable="Orchard.Pages" />

  <Metadata>
    <Types>
      <List>
        <AutoroutePart />
      </List>
    </Types>
  </Metadata>

  <Migration features="*" />

  <Command>
    autoroute create "List" "Title" "{Content.Slug}" "http://website.com/events" true
  </Command>
</Orchard>


text:
<?php
namespace Product\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Product\Model\Product;          // <-- Add this import
use Product\Form\ProductForm;       // <-- Add this import

class ProductController extends AbstractActionController
{
	protected $productTable;
    public function indexAction()
    {
    	return new ViewModel(array(
    			'products' => $this->getProductTable()->fetchAll(),
    	));
    }

    public function addAction()
    {
        $form = new ProductForm();
        $form->get('submit')->setValue('Add');

        $request = $this->getRequest();
        if ($request->isPost()) {
            $product = new Product();
            $form->setInputFilter($product->getInputFilter());
            $form->setData($request->getPost());

            if ($form->isValid()) {
                $product->exchangeArray($form->getData());
                $this->getProductTable()->saveProduct($product);

                // Redirect to list of products
                return $this->redirect()->toRoute('product');
            }
        }
        return array('form' => $form);
    }

    public function editAction()
    {
        $id = (int) $this->params()->fromRoute('id', 0);
        if (!$id) {
            return $this->redirect()->toRoute('product', array(
                'action' => 'add'
            ));
        }
        $product = $this->getProductTable()->getProduct($id);

        $form  = new ProductForm();
        $form->bind($product);
        $form->get('submit')->setAttribute('value', 'Edit');

        $request = $this->getRequest();
        if ($request->isPost()) {
            $form->setInputFilter($product->getInputFilter());
            $form->setData($request->getPost());

            if ($form->isValid()) {
                $this->getProductTable()->saveProduct($form->getData());

                // Redirect to list of products
                return $this->redirect()->toRoute('product');
            }
        }

        return array(
            'id' => $id,
            'form' => $form,
        );
    }

    public function deleteAction()
    {
        $id = (int) $this->params()->fromRoute('id', 0);
        if (!$id) {
            return $this->redirect()->toRoute('product');
        }

        $request = $this->getRequest();
        if ($request->isPost()) {
            $del = $request->getPost('del', 'No');

            if ($del == 'Yes') {
                $id = (int) $request->getPost('id');
                $this->getProductTable()->deleteProduct($id);
            }

            // Redirect to list of products
            return $this->redirect()->toRoute('product');
        }

        return array(
            'id'    => $id,
            'product' => $this->getProductTable()->getProduct($id)
        );
    }

    public function getProductTable()
    {
        if (!$this->productTable) {
            $sm = $this->getServiceLocator();
            $this->productTable = $sm->get('Product\Model\ProductTable');
        }
        return $this->productTable;
    }

}


text:
package com.intellij.codeInsight.intention.impl.lists;

import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

final class JavaListUtils {
  private JavaListUtils() { }

  @Nullable
  static PsiElement prevBreak(@NotNull PsiElement element) {
    PsiElement current = element.getPrevSibling();
    while (current != null && isValidIntermediateElement(current)) {
      if (current instanceof PsiWhiteSpace && current.textContains('\n')) return current;
      current = current.getPrevSibling();
    }
    return null;
  }

  @Nullable
  static PsiElement nextBreak(@NotNull PsiElement element) {
    PsiElement current = element.getNextSibling();
    while (current != null && isValidIntermediateElement(current)) {
      if (current instanceof PsiWhiteSpace && current.textContains('\n')) return current;
      current = current.getNextSibling();
    }
    return null;
  }

  static boolean containsEolComments(@NotNull List<? extends PsiElement> elements) {
    PsiElement parent = elements.get(0).getParent();
    for(PsiElement child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
      if (child instanceof PsiComment && ((PsiComment)child).getTokenType() == JavaTokenType.END_OF_LINE_COMMENT) {
        return true;
      }
    }
    return false;
  }

  private static boolean isValidIntermediateElement(@NotNull PsiElement element) {
    return element instanceof PsiWhiteSpace ||
           (element instanceof PsiJavaToken && ((PsiJavaToken)element).getTokenType() == JavaTokenType.COMMA) ||
           (element instanceof PsiComment && ((PsiComment)element).getTokenType() == JavaTokenType.C_STYLE_COMMENT);
  }

  @Nullable
  static PsiExpressionList getCallArgumentsList(@NotNull PsiElement element) {
    PsiExpressionList expressionList = PsiTreeUtil.getParentOfType(element, PsiExpressionList.class, false, PsiCodeBlock.class);
    if (expressionList == null) return null;
    PsiElement parent = expressionList.getParent();
    if (!(parent instanceof PsiCall)) return null;
    return expressionList;
  }
}


text:
Exercism itself has a nice [learning path for JavaScript](https://exercism.org/tracks/javascript/concepts).
But in case you need more, here are some resources:

- [Learn JavaScript on MDN](https://developer.mozilla.org/en-US/docs/Learn/JavaScript)
- [ES6 Katas](http://es6katas.org)
- [Babel docs](https://babeljs.io/docs/en/learn/)


text:
%% This function needs to return hopefully negative numbers
function [c, ceq] = fisheries_deterministic_2controls_constraints(u,x,conf)
  h = conf.Options.TimeStep;
  next = x + h*fisheries_deterministic_2controls_delta(u,x,0);

  lower = [60 0.1];
  upper = [600 1];

  ceq = [];
  c = [lower - next, next - upper];
end


text:
title: Assignment3 Data Vis Using d3.js
date: 2016-03-06 17:52:22
categories:
- Computer Science
- Data Visualization
tags:
- Assignments
- Programming
---

# README

Small project to get feet wet in [d3.js](https://github.com/mbostock/d3).
Data source are randomly chosen from [here](https://vincentarelbundock.github.io/Rdatasets/datasets.html).

Please click [here](http://bl.ocks.org/hanjoes) to see all the vis.

# Screenshots

![Bar Chart](images/barchartd3.png)

![Line Graph](images/linegraphd3.png)

![Scatter Plot](images/scatterplotd3.png)

![Scatter Plot Matrix](images/scatterplotmatrixd3.png)

![Parallel Coordinates](images/parallelcoordd3.png)

![Geo](images/geod3.png)

![Heatmap](images/heatmapd3.png)


text:
{% extends "base.html" %} {% block main %}

Sign in failed!

 Sorry! Your email or password does not match! Please try again.

 Please sign in

                    <form action="/signin" method="post">

                            Email address
                            <input type="email" name="email" class="form-control" placeholder="Email">

Use email: admin@example.com

                            Password
                            <input type="password" name="password" class="form-control" placeholder="Password">

Use password: 123456

                        <button type="submit" class="btn btn-primary">Sign In</button>
                    </form>

 Video training

                    <video width="100%" controls="controls">
                        <source src="https://github.com/michaelliao/learn-javascript/raw/master/video/vscode-nodejs.mp4">
                    </video>

{% endblock %}


text:
module YARD::CodeObjects

  class StepDefinitionObject < StepTransformerObject ; end

end


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
	<info
		organisation="org.apache.lucene"
		module="replicator"
		revision="working@shyrain"
		conf="servlet"
		confs="http, jetty, start, servlet, logging"
		date="20140708203539"/>
	<dependencies>
		<module organisation="org.eclipse.jetty.orbit" name="javax.servlet">
			<revision name="3.0.0.v201112011016" status="release" pubdate="20111208034915" resolver="public" artresolver="main" homepage="" downloaded="false" searched="false" default="false" conf="default, compile, runtime, master" position="0">
				<metadata-artifact status="no" details="" size="3255" time="0" location="C:\Users\shyrain20\.ivy2\cache\org.eclipse.jetty.orbit\javax.servlet\ivy-3.0.0.v201112011016.xml" searched="false" origin-is-local="false" origin-location="http://repo1.maven.org/maven2/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.pom"/>
				<caller organisation="org.apache.lucene" name="replicator" conf="servlet" rev="3.0.0.v201112011016" rev-constraint-default="3.0.0.v201112011016" rev-constraint-dynamic="3.0.0.v201112011016" callerrev="working@shyrain"/>
				<artifacts>
					<artifact name="javax.servlet" type="orbit" ext="jar" status="no" details="" size="200387" time="0" location="C:\Users\shyrain20\.ivy2\cache\org.eclipse.jetty.orbit\javax.servlet\orbits\javax.servlet-3.0.0.v201112011016.jar">
						<origin-location is-local="false" location="http://repo1.maven.org/maven2/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.jar"/>
					</artifact>
				</artifacts>
			</revision>
		</module>
	</dependencies>
</ivy-report>


text:
package org.switchyard.config.model.composer.v1;

import javax.xml.namespace.QName;

import org.switchyard.common.lang.Strings;
import org.switchyard.config.Configuration;
import org.switchyard.config.model.BaseModel;
import org.switchyard.config.model.Descriptor;
import org.switchyard.config.model.composer.MessageComposerModel;

/**
 * A version 1 MessageComposerModel.
 *
 * @author David Ward <dward@jboss.org> (C) 2011 Red Hat Inc.
 */
public class V1MessageComposerModel extends BaseModel implements MessageComposerModel {

    /**
     * Constructs a new V1MessageComposerModel in the specified namespace.
     * @param namespace the specified namespace
     */
    public V1MessageComposerModel(String namespace) {
        super(new QName(namespace, MESSAGE_COMPOSER));
    }

    /**
     * Constructs a new V1MessageComposerModel with the specified Configuration and Descriptor.
     * @param config the Configuration
     * @param desc the Descriptor
     */
    public V1MessageComposerModel(Configuration config, Descriptor desc) {
        super(config, desc);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getClazz() {
        return Strings.trimToNull(getModelAttribute("class"));
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public MessageComposerModel setClazz(String clazz) {
        setModelAttribute("class", clazz);
        return this;
    }

}


text:
package de.bps.olat.modules.cl;

import java.io.Serializable;
import java.util.Date;

import org.olat.core.commons.persistence.PersistentObject;
import org.olat.core.id.ModifiedInfo;

/**
 * Description:

 * CheckpointResults object, stored in "o_checkpoint_results" via Hibernate
 *
 *

 * Initial Date:  23.07.2009

 * @author bja <bja@bps-system.de>
 */
public class CheckpointResult extends PersistentObject implements ModifiedInfo, Serializable {

	private Date lastModified;
	private boolean result;
	private Long identityId;
	private Checkpoint checkpoint;

	public CheckpointResult() {
		//
	}

	public CheckpointResult(Checkpoint checkpoint, Long identityId, boolean result) {
		this.checkpoint = checkpoint;
		this.identityId = identityId;
		this.result = result;
		this.lastModified = new Date();
	}

	public Checkpoint getCheckpoint() {
		return checkpoint;
	}

	public void setCheckpoint(Checkpoint checkpoint) {
		this.checkpoint = checkpoint;
	}

	/**
	 * @return Returns the lastModified.
	 */
	public Date getLastModified() {
		return lastModified;
	}

	/**
	 * @return Returns the result.
	 */
	public boolean getResult() {
		return result;
	}

	/**
	 * @return Returns the identityId.
	 */
	public Long getIdentityId() {
		return identityId;
	}

	/**
	 * @param lastModified The lastModified to set.
	 */
	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}

	/**
	 * @param result The result to set.
	 */
	public void setResult(boolean result) {
		this.result = result;
	}

	/**
	 * @param identityId The identityId to set.
	 */
	public void setIdentityId(Long identityId) {
		this.identityId = identityId;
	}

}


text:
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
  static class MyList<T> extends ArrayList<List<? extends CharSequence>> {
  }

  private List<? extends CharSequence> asList(CharSequence s) {
    return Collections.singletonList(s);
  }

  public List<? extends CharSequence> getList() {
    return Collections.emptyList();
  }

  private void collect() {
    MyList<? extends List<? extends CharSequence>> res2 =
      getList().stream().map(this::asList).coll<caret>ect(Collectors.toCollection(MyList::new));
    System.out.println(res2);
  }
}


text: LANG_ADMIN_CRON_JOBS=All User Cron Jobs


text:
package org.nvonop.selenium.framework.controls;

import org.nvonop.selenium.framework.controls.interfaces.Detectable;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * This abstract class will be extended by various UI control classes. It simply
 * acts as a container for functionality that could be considered common to all
 * UI controls.
 *
 * @author nvonop
 */
public abstract class BaseControl implements Detectable {

    private static final Logger LOGGER = Logger.getLogger(BaseControl.class
            .getName());
    protected WebDriver driver;
    private WebElement baseWebElement;
    private long delay = Long.valueOf(System.getProperty("DELAY", "10"))
            .longValue();
    private By locator;
    private long timeout = Long.valueOf(System.getProperty("TIMEOUT", "10"))
            .longValue();

    /*
     * (non-Javadoc)
     *
     * @see framework.controls.interfaces.Detectable#exists()
     */
    @Override
    public boolean exists() {
        try {
            findControl();
            return baseWebElement.isDisplayed();
        } catch (NoSuchElementException e) {
            LOGGER.log(Level.INFO,
                    "NoSuchElementException in exists() method", e);
            return false;
        } catch (ElementNotVisibleException e) {
            LOGGER.log(Level.INFO,
                    "ElementNotVisibleException in exists() method", e);
            return false;
        } catch (TimeoutException e) {
            LOGGER.log(Level.INFO, "TimeoutException in exists() method", e);
            return false;
        }
    }

    /*
     * This method wraps the findElement method and returns a WebElement. By
     * default it will attempt to wait for an element to be clickable before
     * returning it. If this fails then after 10 seconds it will simply match
     * the element if possible and return it.
     */
    protected WebElement findControl() {
        try {
            LOGGER.log(Level.FINEST,
                    "Looking for WebElement: " + locator.toString());

            waitForElementThenInitialise();

            return baseWebElement;

        } catch (NoSuchElementException e) {
            LOGGER.log(Level.SEVERE,
                    "NoSuchElementException in findControl() method for: "
                            + locator.toString(), e);
            throw new NoSuchElementException(locator.toString());
        }
    }

    private void waitForElementThenInitialise() {
        WebDriverWait wait = new WebDriverWait(driver, timeout);
        try {
            baseWebElement = wait.until(ExpectedConditions
                    .elementToBeClickable(getLocator()));
            waitForControlToStopMoving();
        } catch (InterruptedException e) {
            LOGGER.log(Level.INFO,
                    "InterruptedException in findControl() method", e);
        } catch (TimeoutException e) {
            LOGGER.log(Level.INFO, "TimeoutException in findControl() method",
                    e);
        }
        if (baseWebElement == null) {
            baseWebElement = driver.findElement(locator);
        }
    }

    /*
     * This method wraps the findElement method and returns a WebElement using
     * theLocator parameter. By default it will attempt to wait for an element
     * to be clickable and stationary before returning it. If this fails then
     * after 10 seconds it will simply match the element if possible and return
     * it.
     */
    protected WebElement findControl(By theLocator) {
        try {
            setLocator(theLocator);
            LOGGER.log(Level.FINEST,
                    "Looking for WebElement: " + locator.toString());

            waitForElementThenInitialise();
            return baseWebElement;

        } catch (NoSuchElementException e) {
            LOGGER.log(Level.SEVERE,
                    "NoSuchElementException in findControl() method for: "
                            + locator.toString(), e);
            throw new NoSuchElementException(locator.toString());
        }
    }

    protected By getLocator() {
        return locator;
    }

    protected void setLocator(By theLocator) {
        locator = theLocator;
    }

    /**
     * This method enables a test to gain access to the WebElement object and
     * access the WebDriver API directly.
     *
     * @return The underlying WebElement object.
     */
    public WebElement getUnderlyingWebElement() {
        return findControl(locator);
    }

    private void waitForControlToStopMoving() throws InterruptedException {
        Point elementStartLocation = baseWebElement.getLocation();
        Thread.sleep(delay);
        Point elementCurrentLocation = baseWebElement.getLocation();
        while (!elementCurrentLocation.equals(elementStartLocation)) {
            elementStartLocation = elementCurrentLocation;
            Thread.sleep(delay);
            elementCurrentLocation = baseWebElement.getLocation();
        }
    }
}