NUnit.Framework.Assert.That(bool)

Here are the examples of the csharp api NUnit.Framework.Assert.That(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

188 Examples 7

19 View Source File : BasicParserTests.cs
License : MIT License
Project Creator : alkampfergit

[Test]
        public void Multiline_query()
        {
            var sut = new ConfigurationParser();
            TemplateDefinition def = sut.ParseTemplateDefinition(
@"[[query]]
query: ""SELECT
    * 
    FROM workitems
    WHERE
        [System.TeamProject] = @project
        AND [System.WorkItemType] = 'Product Backlog Item'
        AND [System.IterationPath] = '{iterationPath}'""
");
            var querySection = def.AllSections.Single() as QuerySection;
            replacedert.That(querySection.Query.Contains("AND [System.IterationPath] = '{iterationPath}'"));
            replacedert.That(querySection.Query.Contains("[System.TeamProject] = @project"));
        }

19 View Source File : BasicParserTests.cs
License : MIT License
Project Creator : alkampfergit

[Test]
        public void Multiline_query_complex()
        {
            var sut = new ConfigurationParser();
            TemplateDefinition def = sut.ParseTemplateDefinition(
@"[[query]]
    query: ""SELECT
        *
        FROM
            workitems
        WHERE
            [System.WorkItemType] = 'Feature' AND
            [Microsoft.VSTS.Scheduling.TargetDate] >= '{TargetDateStart}' AND
            [Microsoft.VSTS.Scheduling.TargetDate] <= '{TargetDateEnd}' AND
            NOT[System.Tags] CONTAINS 'outofrelease' AND

            NOT[System.Tags] CONTAINS 'Report' AND
            [System.TeamProject] = '{teamProjectName}'
          AND(
            [System.IterationPath] = '{Iteration1}'
            OR [System.IterationPath] = '{Iteration2}'
            OR [System.IterationPath] = '{Iteration3}'
            OR [System.IterationPath] = '{Iteration4}'
            Or [System.IterationPath] = '{Iteration5}'
          )""
    tableTemplate: 2_table.docx
");
            var querySection = def.AllSections.Single() as QuerySection;
            replacedert.That(querySection.Query.Contains("Or [System.IterationPath] = '{Iteration5}'"));
        }

19 View Source File : SingleSectionParserTests.cs
License : MIT License
Project Creator : alkampfergit

[Test]
        public void MultiLine_key_value_query()
        {
            var keyValue = ConfigurationParser.MultiLineKeyValue.Parse(
      @"query: ""SELECT
        * 
        FROM workitems
        WHERE
            [System.TeamProject] = @project
            AND [System.WorkItemType] = 'Product Backlog Item'
            AND [System.IterationPath] = '{iterationPath}'""");
            replacedert.That(keyValue.Key, Is.EqualTo("query"));
            replacedert.That(keyValue.Value.Contains("[System.TeamProject] = @project"));
        }

19 View Source File : SingleSectionParserTests.cs
License : MIT License
Project Creator : alkampfergit

[Test]
        public void MultiLine_key_value_query_plus_parameter()
        {
            var keyValue = ConfigurationParser.MultiLineKeyValue.Parse(
      @"query: ""SELECT
        * 
        FROM workitems
        WHERE
            [System.TeamProject] = @project
            AND [System.WorkItemType] = 'Product Backlog Item'
            AND [System.IterationPath] = '{iterationPath}'""
        queryParameter: test");
            replacedert.That(keyValue.Key, Is.EqualTo("query"));
            replacedert.That(keyValue.Value.Contains("[System.TeamProject] = @project"));
        }

19 View Source File : WordManipulationTests.cs
License : MIT License
Project Creator : alkampfergit

[Test]
        public void Basic_replace()
        {
            var baseFile = CopyTestFileIntoTempDirectory("simple.docx");

            using (var wm = new WordManipulator(baseFile, false))
            {
                wm.SubsreplaceduteTokens(new Dictionary<string, object>()
                {
                    ["text"] = "this is the content of text",
                    ["example"] = "This is the content of example"
                });
            }

            using (var wm = new WordManipulator(baseFile, false))
            {
                var paragraphs = wm.DoreplacedentBody.Descendants<Paragraph>();
                replacedert.That(paragraphs.Any(_ => _.InnerText.Contains("this is the content of text")));
                replacedert.That(paragraphs.Any(_ => _.InnerText.Contains("This is the content of example")));
            }

            //Open(baseFile);
        }

19 View Source File : WordManipulationTests.cs
License : MIT License
Project Creator : alkampfergit

[Test]
        public void TestCompositeTable()
        {
            var baseFile = CopyTestFileIntoTempDirectory("tableworkitem.docx");

            using (var wm = new WordManipulator(baseFile, false))
            {
                wm.FillCompositeTable(true, new Dictionary<String, Object>[]
                {
                    new Dictionary<String, Object> {
                        ["Id"]  = "1",
                        ["replacedle"] = "replacedle 1",
                        ["replacedignedto"] = "Gian Maria",
                        ["description"] = "Description - 1 this can be really long"
                    },
                     new Dictionary<String, Object> {
                        ["Id"]  = "2",
                        ["replacedle"] = "replacedle 2",
                        ["replacedignedto"] = "Other member of the team",
                        ["description"] = "Description - 2 this can be really long"
                    }
                });
            }

            using (var wm = new WordManipulator(baseFile, false))
            {
                var table = wm.DoreplacedentBody.Descendants<Table>().First();
                var paragraphs = table.Descendants<Paragraph>();
                replacedert.That(paragraphs.Any(_ => _.InnerText.Contains("replacedle 2")));
            }

            //Open(baseFile);
        }

19 View Source File : TestColorMap.cs
License : MIT License
Project Creator : ar1st0crat

[Test]
        public void TestDefaultJetPaletteIsAvailable()
        {
            replacedert.That(ColorMap.Palettes.Contains(DefaultPalette));
        }

19 View Source File : ClayTests.cs
License : MIT License
Project Creator : bleroy

[Test]
        public void CreateSyntax() {

            var form = New.Form(new { Misc = 4 })
                .Actions(New.Fieldset()
                    .Save(New.Button().Value("Save").Id("Hello"))
                    .Cancel(New.Button().Value("Cancel")));


            var bar = New.Foo(new { Bleah = (object)null });

            replacedert.That(bar.Bleah(), Is.SameAs(Nil.Instance));
            replacedert.That(bar.Bleah, Is.SameAs(Nil.Instance));
            replacedert.That(bar.Yarg, Is.SameAs(Nil.Instance));
            replacedert.That(bar.One.Two.Three()["Four"], Is.SameAs(Nil.Instance));

            var foo1 = bar.Foo;
            string foo2 = bar.Foo;
            int? foo3 = bar.Foo;
            var foo4 = bar.Foo == null;
            var foo5 = bar.Foo != null;
            var foo6 = (ITest)bar.Foo;
            var foo7 = (string)bar.Foo ?? "yarg";

            //            var foo8 = bar.Foo ? bar.Foo : (dynamic)"yarg";


            replacedert.That(foo1, Is.SameAs(Nil.Instance));
            replacedert.That(foo2, Is.Null);
            replacedert.That(foo3, Is.Null);
            replacedert.That(foo4, Is.True);
            replacedert.That(foo5, Is.False);
            replacedert.That(foo6, Is.Not.Null);
            replacedert.That(foo7, Is.EqualTo("yarg"));
            //replacedert.That(foo8, Is.EqualTo("yarg"));

            //            form.Actions += bar;

            form.Misc += 3;

            replacedert.That(form.ShapeName, Is.EqualTo("Form"));
            replacedert.That(form.Misc, Is.EqualTo(7));
            replacedert.That(form.Actions.Save.Id, Is.EqualTo("Hello"));
            replacedert.That(form.Actions.Save.Value, Is.EqualTo("Save"));
            replacedert.That(form.Actions.Cancel.Value, Is.EqualTo("Cancel"));

            replacedert.That(form.Misc(), Is.EqualTo(7));
            replacedert.That(form.Actions().Save().Id(), Is.EqualTo("Hello"));
            replacedert.That(form.Actions().Save().Value(), Is.EqualTo("Save"));
            replacedert.That(form.Actions().Cancel().Value(), Is.EqualTo("Cancel"));

            form[3] = "hello";

            replacedert.That(form["Misc"], Is.EqualTo(7));
            replacedert.That(form["Actions"]["Save"]["Id"], Is.EqualTo("Hello"));
            replacedert.That(form["Actions"]["Save"]["Value"], Is.EqualTo("Save"));
            replacedert.That(form["Actions"]["Cancel"]["Value"], Is.EqualTo("Cancel"));

            ITestForm f = form;
            replacedert.That(f.Misc, Is.EqualTo(7));
            replacedert.That(f.Actions.ShapeName, Is.EqualTo("Fieldset"));
            replacedert.That(f.Actions.Save.Id, Is.EqualTo("Hello"));
            replacedert.That(f.Actions.Save.Value, Is.EqualTo("Save"));
            replacedert.That(f.Actions.Cancel.Value, Is.EqualTo("Cancel"));
            replacedert.That(f.Actions.Preview.Id, Is.Null);
            replacedert.That((dynamic)f.Actions.Preview == null);

            replacedert.That(f["Misc"], Is.EqualTo(7));
            f["Misc"] = 4;
            replacedert.That(f.Misc, Is.EqualTo(4));
            replacedert.That(f["Misc"], Is.EqualTo(4));
            replacedert.That(form.Misc, Is.EqualTo(4));

            f.Misc = 9;
            replacedert.That(f.Misc, Is.EqualTo(9));
            replacedert.That(f["Misc"], Is.EqualTo(9));
            replacedert.That(form.Misc, Is.EqualTo(9));
        }

19 View Source File : DefaultClayActivatorTests.cs
License : MIT License
Project Creator : bleroy

[Test]
        public void ClaySubclreplacedFromAnythingIsActivatedDynamixProxyAddingDlrInterfaces() {
            var alpha = ClayActivator.CreateInstance<Anything>(Enumerable.Empty<IClayBehavior>());

            var type = alpha.GetType();

            replacedert.That(type, Is.Not.EqualTo(typeof(Anything)));
            replacedert.That(typeof(Anything).IsreplacedignableFrom(type));

        }

19 View Source File : Happy_path_mutating_nunit_tests.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_the_expected_surviving_mutants_are_returned()
        {
            replacedert.That(MutationTestResult.SurvivingMutants.Count, Is.EqualTo(11),
                string.Join(Environment.NewLine, MutationTestResult.SurvivingMutants.Select(sm =>
                    $"{Path.GetFileName(sm.SourceFilePath)}:{sm.SourceLine} \"{sm.OriginalLine}\" => \"{sm.MutatedLine}\"")));

            replacedert.That(MutationTestResult.SurvivingMutants.All(sm => sm.SourceFilePath.EndsWith(@"PartiallyTestedNumberComparison.cs")));

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 7 &&
                      sm.OriginalLine.EndsWith("return a > 0;") &&
                      sm.MutatedLine.EndsWith("return a >= 0;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 12 &&
                      sm.OriginalLine.EndsWith("return a < 0;") &&
                      sm.MutatedLine.EndsWith("return a <= 0;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 17 &&
                      sm.OriginalLine.EndsWith("return a == 0;") &&
                      sm.MutatedLine.EndsWith("return a != 0;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 22 &&
                      sm.OriginalLine.EndsWith("return a == 0 && b == 0;") &&
                      sm.MutatedLine.EndsWith("return a == 0 || b == 0;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 27 &&
                      sm.OriginalLine.EndsWith("return a + b;") &&
                      sm.MutatedLine.EndsWith("return a - b;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 32 &&
                      sm.OriginalLine.EndsWith("return ++a;") &&
                      sm.MutatedLine.EndsWith("return --a;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 37 &&
                      sm.OriginalLine.EndsWith("a++;") &&
                      sm.MutatedLine.EndsWith("a--;")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                sm => sm.SourceLine == 43 &&
                      sm.OriginalLine.EndsWith("IsPositive(n) ? \"positive\" : \"negative\";") &&
                      sm.MutatedLine.EndsWith("IsPositive(n) ? \"negative\" : \"positive\";")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                    sm => sm.SourceLine == 79 &&
                          sm.OriginalLine.EndsWith("IsPositive(n) ? \"positive\" : \"negative\";") &&
                          sm.MutatedLine.EndsWith("IsPositive(n) ? \"negative\" : \"positive\";")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                    sm => sm.SourceLine == 84 &&
                          sm.OriginalLine.EndsWith("get { return 40 + 2; }") &&
                          sm.MutatedLine.EndsWith("get { return 40 - 2; }")),
                Is.Not.Null);

            replacedert.That(MutationTestResult.SurvivingMutants.SingleOrDefault(
                    sm => sm.SourceLine == 89 &&
                          sm.OriginalLine.EndsWith("if (b)") &&
                          sm.MutatedLine.EndsWith("if (!(b))")),
                Is.Not.Null);
        }

19 View Source File : Projects_are_filtered.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_only_files_matching_filter_are_candidates_for_mutation()
        {
            replacedert.That(SpyEventListener.BegunFiles.Any());
            replacedert.That(SpyEventListener.BegunFiles.All(f => f.Contains(@"\MoreImplementation\")));
        }

19 View Source File : Projects_are_filtered_with_multiple_filters.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_only_files_matching_either_filter_are_candidates_for_mutation()
        {
            replacedert.That(SpyEventListener.BegunFiles.Any());
            replacedert.That(SpyEventListener.BegunFiles.All(f => f.Contains(@"\MoreImplementation\") ||
                                                             f.Contains(@"\Implementation\")));
        }

19 View Source File : Projects_are_not_filtered.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_all_files_are_candidates_for_mutation()
        {
            replacedert.That(SpyEventListener.BegunFiles.Any(f => f.EndsWith("PartiallyTestedNumberComparison.cs")));
            replacedert.That(SpyEventListener.BegunFiles.Any(f => f.EndsWith("MorePartiallyTestedNumberComparison.cs")));
        }

19 View Source File : Source_files_are_filtered.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_only_files_matching_filter_are_candidates_for_mutation()
        {
            replacedert.That(SpyEventListener.BegunFiles.Any());
            replacedert.That(SpyEventListener.BegunFiles.All(f => f.EndsWith("Comparison.cs")));            
        }

19 View Source File : Source_files_are_filtered_with_multiple_filters.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_only_files_matching_either_filter_are_candidates_for_mutation()
        {
            replacedert.That(SpyEventListener.BegunFiles.Any());
            replacedert.That(SpyEventListener.BegunFiles.All(f => f.EndsWith(@"Implementation\PartiallyTestedNumberComparison.cs") ||
                                                             f.EndsWith(@"Implementation\MorePartiallyTestedNumberComparison.cs")));            
        }

19 View Source File : Source_files_are_not_filtered.cs
License : MIT License
Project Creator : ComparetheMarket

[Test]
        public void Then_all_files_are_candidates_for_mutation()
        {
            replacedert.That(SpyEventListener.BegunFiles.Any(f => f.EndsWith(@"Implementation\PartiallyTestedNumberComparison.cs")));
            replacedert.That(SpyEventListener.BegunFiles.Any(f => f.EndsWith(@"Implementation\MorePartiallyTestedNumberComparison.cs")));            
        }

19 View Source File : ParserTests.cs
License : MIT License
Project Creator : cyberark

[Test]
        public void ParseEdge()
        {
            var graph = Parse("graph { 0 [width=30]; 1; 2; 0 -> 1; 1 -- 2; }");
            replacedert.AreEqual(2, graph.Edges.Count());
            replacedert.That(graph.Edges.Any(e => ((DotEdge<int>) e).Source.Id == 0 && ((DotEdge<int>) e).Destination.Id == 1));
            replacedert.That(graph.Edges.Any(e => ((DotEdge<int>) e).Source.Id == 1 && ((DotEdge<int>) e).Destination.Id == 2));
        }

19 View Source File : EmptyEvent.cs
License : MIT License
Project Creator : evilC

[TestCase(TestName = "When the Empty event fires, it provides the correct arguments")]
        public void TestMethod3()
        {
            var dict = new EmptyEventDictionary<int, int, string>(EventArgs, EmptyEventHandler);
            dict.TryAdd(1, 100);
            dict.TryRemove(1, out _);
            replacedert.That(_callbacks[0] == EventArgs);
        }

19 View Source File : AnonymousTypeTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void AnonymousTypeToString() {
			string program = @"
clreplaced TestClreplaced {
	void F() {
		var s = $new { Prop = 0 }.ToString()$;
	}
}";

			var result = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(result.IsError, Is.False);
			replacedert.That(result.TargetResult.Type.Kind == TypeKind.Anonymous);
			replacedert.That(result.Member.Name, Is.EqualTo("ToString"));
			replacedert.That(result.Member.DeclaringType.Name, Is.EqualTo("Object"));
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void DynamicInvocation() {
			string program = @"using System;
clreplaced TestClreplaced {
	void F() {
		dynamic obj = null;
		int a = 0;
		string b = null;
		$obj.SomeMethod(a, b)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.Type.Kind, Is.EqualTo(TypeKind.Dynamic));
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));
			replacedert.That(rr.Target, Is.InstanceOf<DynamicMemberResolveResult>());
			var dynamicMember = (DynamicMemberResolveResult)rr.Target;
			replacedert.That(dynamicMember.Target is LocalResolveResult && ((LocalResolveResult)dynamicMember.Target).Variable.Name == "obj");
			replacedert.That(dynamicMember.Member, Is.EqualTo("SomeMethod"));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "a");
			replacedert.That(rr.Arguments[1] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1]).Variable.Name == "b");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void DynamicInvocationWithNamedArguments() {
			string program = @"using System;
clreplaced TestClreplaced {
	void F() {
		dynamic obj = null;
		int a = 0, x = 0;
		string b = null;
		$obj.SomeMethod(x, param1: a, param2: b)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.Type.Kind, Is.EqualTo(TypeKind.Dynamic));
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));
			replacedert.That(rr.Target, Is.InstanceOf<DynamicMemberResolveResult>());
			var dynamicMember = (DynamicMemberResolveResult)rr.Target;
			replacedert.That(dynamicMember.Target is LocalResolveResult && ((LocalResolveResult)dynamicMember.Target).Variable.Name == "obj");
			replacedert.That(dynamicMember.Member, Is.EqualTo("SomeMethod"));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(3));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "x");
			replacedertNamedArgument<LocalResolveResult>(rr.Arguments[1], "param1", lrr => lrr.Variable.Name == "a");
			replacedertNamedArgument<LocalResolveResult>(rr.Arguments[2], "param2", lrr => lrr.Variable.Name == "b");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void TwoDynamicInvocationsInARow() {
			string program = @"using System;
clreplaced TestClreplaced {
	void F() {
		dynamic obj = null;
		int a = 0, b = 0;
		$obj.SomeMethod(a)(b)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.Type.Kind, Is.EqualTo(TypeKind.Dynamic));
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));
			replacedert.That(rr.Target, Is.InstanceOf<DynamicInvocationResolveResult>());
			var innerInvocation = (DynamicInvocationResolveResult)rr.Target;
			replacedert.That(innerInvocation.Target, Is.InstanceOf<DynamicMemberResolveResult>());
			var dynamicMember = (DynamicMemberResolveResult)innerInvocation.Target;
			replacedert.That(dynamicMember.Target is LocalResolveResult && ((LocalResolveResult)dynamicMember.Target).Variable.Name == "obj");
			replacedert.That(dynamicMember.Member, Is.EqualTo("SomeMethod"));
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));
			replacedert.That(innerInvocation.Arguments.Count, Is.EqualTo(1));
			replacedert.That(innerInvocation.Arguments[0] is LocalResolveResult && ((LocalResolveResult)innerInvocation.Arguments[0]).Variable.Name == "a");
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "b");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWithOneApplicableMethod() {
			string program = @"using System;
clreplaced TestClreplaced {
	public int SomeMethod(int a) {}
	public int SomeMethod(int a, string b) {}

	void F() {
		dynamic obj = null;
		var x = $this.SomeMethod(obj)$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr, Is.Not.Null);
			replacedert.That(rr.Member.Name, Is.EqualTo("SomeMethod"));
			replacedert.That(rr.Type.Kind == TypeKind.Dynamic);
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Conversion.IsImplicit, Is.True);
			replacedert.That(cr.Conversion.IsDynamicConversion, Is.True);
			replacedert.That(cr.Input is LocalResolveResult && ((LocalResolveResult)cr.Input).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWithOneApplicableMethodReturningVoid() {
			string program = @"using System;
clreplaced TestClreplaced {
	public void SomeMethod(int a) {}

	void F() {
		dynamic obj = null;
		var x = $this.SomeMethod(obj)$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.IsError, Is.False);
			replacedert.That(rr.Type.Kind, Is.EqualTo(TypeKind.Dynamic));
			replacedert.That(rr.Member.Name, Is.EqualTo("SomeMethod"));
			replacedert.That(rr.Member.Parameters.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Conversion.IsImplicit, Is.True);
			replacedert.That(cr.Conversion.IsDynamicConversion, Is.True);
			replacedert.That(cr.Input is LocalResolveResult && ((LocalResolveResult)cr.Input).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWhenBothAnOwnAndABaseMethodAreApplicable() {
			string program = @"using System;
clreplaced TestBase {
	public void SomeMethod(int a) {}
}

clreplaced TestClreplaced : TestBase {
	public void SomeMethod(string a) {}
	public void SomeMethod(string a, int b) {}

	void F() {
		dynamic obj = null;
		var x = $this.SomeMethod(obj)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.InstanceOf<ThisResolveResult>());
			replacedert.That(mg.MethodName, Is.EqualTo("SomeMethod"));
			replacedert.That(mg.Methods.Count(), Is.EqualTo(2));
			replacedert.That(mg.Methods.Any(m => m.Parameters.Count == 1 && m.DeclaringType.Name == "TestBase" && m.Name == "SomeMethod" && m.Parameters[0].Type.Name == "Int32"));
			replacedert.That(mg.Methods.Any(m => m.Parameters.Count == 1 && m.DeclaringType.Name == "TestClreplaced" && m.Name == "SomeMethod" && m.Parameters[0].Type.Name == "String"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test, Ignore("Fails")]
		public void InvocationWithDynamicArgumentWhenABaseMethodIsShadowed() {
			string program = @"using System;
clreplaced TestBase {
	public void SomeMethod(int a) {}
}

clreplaced TestClreplaced : TestBase {
	public void SomeMethod(int a) {}
	public void SomeMethod(string a, int b) {}

	void F() {
		dynamic obj = null;
		var x = $this.SomeMethod(obj)$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.Member.Name, Is.EqualTo("SomeMethod"));
			replacedert.That(rr.Member.DeclaringType.Name, Is.EqualTo("TestClreplaced"));
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Conversion.IsImplicit, Is.True);
			replacedert.That(cr.Conversion.IsDynamicConversion, Is.True);
			replacedert.That(cr.Input is LocalResolveResult && ((LocalResolveResult)cr.Input).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWithTwoApplicableMethods() {
			string program = @"using System;
clreplaced TestClreplaced {
	public void SomeMethod(int a) {}
	public void SomeMethod(string a) {}
	public void SomeMethod(int a, string b) {}

	void F() {
		dynamic obj = null;
		var x = $SomeMethod(obj)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.InstanceOf<ThisResolveResult>());
			replacedert.That(mg.MethodName, Is.EqualTo("SomeMethod"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 1));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWithTwoApplicableStaticMethods() {
			string program = @"using System;
clreplaced TestClreplaced {
	public static void SomeMethod(int a) {}
	public static void SomeMethod(string a) {}
	public static void SomeMethod(int a, string b) {}

	void F() {
		dynamic obj = null;
		var x = $SomeMethod(obj)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.InstanceOf<TypeResolveResult>());
			replacedert.That(mg.MethodName, Is.EqualTo("SomeMethod"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 1));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWithApplicableStaticAndNonStaticMethodsFavorTheNonStaticOne() {
			string program = @"using System;
clreplaced TestClreplaced {
	public static void SomeMethod(int a) {}
	public void SomeMethod(string a) {}
	public static void SomeMethod(int a, string b) {}

	void F() {
		dynamic obj = null;
		var x = $SomeMethod(obj)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.InstanceOf<ThisResolveResult>());
			replacedert.That(mg.MethodName, Is.EqualTo("SomeMethod"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 1));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test, Ignore("Fails")]
		public void IndexingWithDynamicArgumentWithTheOnlyApplicableIndexerShadowingABaseIndexer() {
			string program = @"using System;
clreplaced TestBase {
	public int this[int a] { get { return 0; } }
}

clreplaced TestClreplaced : TestBase {
	public new int this[int a] { get { return 0; } }
	public int this[int a, string b] { get { return 0; } }

	void F() {
		dynamic obj = null;
		var x = $this[obj]$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.Member.Name, Is.EqualTo("Item"));
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Conversion.IsImplicit, Is.True);
			replacedert.That(cr.Conversion.IsDynamicConversion, Is.True);
			replacedert.That(cr.Input is LocalResolveResult && ((LocalResolveResult)cr.Input).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InvocationWithDynamicArgumentWithTwoApplicableMethodsAndNamedArguments() {
			string program = @"using System;
clreplaced TestClreplaced {
	public void SomeMethod(int a, int i) {}
	public void SomeMethod(string a, int i) {}
	public void SomeMethod(int a, string b, int i) {}

	void F() {
		dynamic obj = null;
		int idx = 0;
		var x = $this.SomeMethod(a: obj, i: idx)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.Invocation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.InstanceOf<ThisResolveResult>());
			replacedert.That(mg.MethodName, Is.EqualTo("SomeMethod"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 2) && mg.Methods.All(m => m.Parameters[1].Type.Name == "Int32"));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == "SomeMethod" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedertNamedArgument<LocalResolveResult>(rr.Arguments[0], "a", lrr => lrr.Variable.Name == "obj");
			replacedertNamedArgument<LocalResolveResult>(rr.Arguments[1], "i", lrr => lrr.Variable.Name == "idx");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void IndexingWithDynamicArgumentWithOneApplicableIndexer() {
			string program = @"using System;
clreplaced TestClreplaced {
	public int this[int a] { get { return 0; } }
	public int this[int a, string b] { get { return 0; } }

	void F() {
		dynamic obj = null;
		var x = $this[obj]$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.Member.Name, Is.EqualTo("Item"));
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Conversion.IsImplicit, Is.True);
			replacedert.That(cr.Conversion.IsDynamicConversion, Is.True);
			replacedert.That(cr.Input is LocalResolveResult && ((LocalResolveResult)cr.Input).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConstructingObjectWithDynamicArgumentWithOneApplicableConstructor() {
			string program = @"using System;
clreplaced TestClreplaced {
	public TestClreplaced(int a) {}
	public void TestClreplaced(int a, string b) {}

	void F() {
		dynamic obj = null;
		var x = $new TestClreplaced(obj)$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.Member.Name, Is.EqualTo(".ctor"));
			replacedert.That(rr.TargetResult, Is.Null);
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(1));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(1));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Input is LocalResolveResult && ((LocalResolveResult)cr.Input).Variable.Name == "obj");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConstructingObjectWithDynamicArgumentWithTwoApplicableConstructors() {
			string program = @"using System;
clreplaced TestClreplaced {
	public TestClreplaced(int a, int b) {}
	public TestClreplaced(string a, int b) {}
	public void TestClreplaced(int a, string b) {}

	void F() {
		dynamic obj = null;
		int i = 0;
		var x = $new TestClreplaced(obj, i)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.ObjectCreation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.Null);
			replacedert.That(mg.MethodName, Is.EqualTo(".ctor"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 2 && m.Parameters[1].Type.Name == "Int32"));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedert.That(rr.Arguments[0] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[0]).Variable.Name == "obj");
			replacedert.That(rr.Arguments[1] is LocalResolveResult && ((LocalResolveResult)rr.Arguments[1]).Variable.Name == "i");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConstructingObjectWithDynamicArgumentWithTwoApplicableConstructorsAndNamedArguments() {
			string program = @"using System;
clreplaced TestClreplaced {
	public TestClreplaced(int arg1, int arg2) {}
	public TestClreplaced(string arg1, int arg2) {}
	public void TestClreplaced(int a) {}

	void F() {
		dynamic obj = null;
		int i = 0;
		var x = $new TestClreplaced(arg1: obj, arg2: i)$;
	}
}";
			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.ObjectCreation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.Null);
			replacedert.That(mg.MethodName, Is.EqualTo(".ctor"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 2 && m.Parameters[1].Type.Name == "Int32"));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedertNamedArgument<LocalResolveResult>(rr.Arguments[0], "arg1", lrr => lrr.Variable.Name == "obj");
			replacedertNamedArgument<LocalResolveResult>(rr.Arguments[1], "arg2", lrr => lrr.Variable.Name == "i");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InitializingBaseWithDynamicArgumentAndOneApplicableConstructor() {
			string program = @"using System;
clreplaced TestBase {
	public TestBase(int a, int b) {}
	public TestBase(string a) {}
}

clreplaced TestClreplaced : TestBase {
	private static dynamic d;
	private static int i;

	public TestClreplaced() : $base(d, i)$ {}
}";

			var rr = Resolve<CSharpInvocationResolveResult>(program);

			replacedert.That(rr.Member.Name, Is.EqualTo(".ctor"));
			replacedert.That(rr.TargetResult, Is.Null);
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(2));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedert.That(rr.Member.DeclaringType.Name, Is.EqualTo("TestBase"));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Input is MemberResolveResult && ((MemberResolveResult)cr.Input).Member.Name == "d");
			replacedert.That(rr.Arguments[1] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1]).Member.Name == "i");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void InitializingBaseWithDynamicArgumentAndTwoApplicableConstructors() {
			string program = @"using System;
clreplaced TestBase {
	public TestBase(int a, int b) {}
	public TestBase(string a, int b) {}
	public TestBase(string a) {}
}

clreplaced TestClreplaced : TestBase {
	private static dynamic d;
	private static int i;

	public TestClreplaced() : $base(d, i)$ {}
}";

			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.ObjectCreation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.Null);
			replacedert.That(mg.MethodName, Is.EqualTo(".ctor"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 2 && m.Parameters[1].Type.Name == "Int32"));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestBase"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedert.That(rr.Arguments[0] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[0]).Member.Name == "d");
			replacedert.That(rr.Arguments[1] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1]).Member.Name == "i");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConstructorChainingWithDynamicArgumentAndOneApplicableConstructor() {
			string program = @"using System;
clreplaced TestClreplaced {
	private static dynamic d;
	private static int i;

	public TestClreplaced(int a, int b) {}
	public TestClreplaced(string a) {}

	public TestClreplaced() : $this(d, i)$ {}
}";

			var rr = Resolve<CSharpInvocationResolveResult>(program);

			replacedert.That(rr.Member.Name, Is.EqualTo(".ctor"));
			replacedert.That(rr.TargetResult, Is.Null);
			replacedert.That(((IParameterizedMember)rr.Member).Parameters.Count, Is.EqualTo(2));
			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedert.That(rr.Member.DeclaringType.Name, Is.EqualTo("TestClreplaced"));
			var cr = rr.Arguments[0] as ConversionResolveResult;
			replacedert.That(cr, Is.Not.Null);
			replacedert.That(cr.Input is MemberResolveResult && ((MemberResolveResult)cr.Input).Member.Name == "d");
			replacedert.That(rr.Arguments[1] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1]).Member.Name == "i");
		}

19 View Source File : DynamicTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConstructorChainingWithDynamicArgumentAndTwoApplicableConstructors() {
			string program = @"using System;
clreplaced TestBase {
}

clreplaced TestClreplaced {
	private static dynamic d;
	private static int i;

	public TestClreplaced(int a, int b) {}
	public TestClreplaced(string a, int b) {}
	public TestClreplaced(string a) {}

	public TestClreplaced() : $this(d, i)$ {}
}";

			var rr = Resolve<DynamicInvocationResolveResult>(program);
			replacedert.That(rr.InvocationType, Is.EqualTo(DynamicInvocationType.ObjectCreation));

			var mg = rr.Target as MethodGroupResolveResult;
			replacedert.That(mg, Is.Not.Null, "Expected a MethodGroup");
			replacedert.That(mg.TargetResult, Is.Null);
			replacedert.That(mg.MethodName, Is.EqualTo(".ctor"));
			replacedert.That(mg.Methods.All(m => m.Parameters.Count == 2 && m.Parameters[1].Type.Name == "Int32"));
			replacedert.That(mg.Methods.Select(m => m.Parameters[0].Type.Name), Is.EquivalentTo(new[] { "Int32", "String" }));
			replacedert.That(mg.Methods.All(m => m.Name == ".ctor" && m.DeclaringType.Name == "TestClreplaced"));

			replacedert.That(rr.Arguments.Count, Is.EqualTo(2));
			replacedert.That(rr.Arguments[0] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[0]).Member.Name == "d");
			replacedert.That(rr.Arguments[1] is MemberResolveResult && ((MemberResolveResult)rr.Arguments[1]).Member.Name == "i");
		}

19 View Source File : InvocationTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void OverloadResolutionBetweenArrayAndArrayType() {
			string program = @"using System;
public clreplaced C {
	static void F(Array a, Func<object, object> f) {}
	static void F(string[] a, Func<string, object> f) {}

	public static void M() {
		$F(new string[0], n => 0)$;
	}
}";

			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.IsError, Is.False);
			replacedert.That(rr.Member.Parameters[0].Type.Kind == TypeKind.Array);
		}

19 View Source File : InvocationTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void OverloadResolutionBetweenArrayAndArrayTypeGeneric() {
			string program = @"using System;
public clreplaced C {
	static void F(Array a, Func<object, object> f) {}
	static void F<T>(T[] a, Func<T, object> f) {}

	public static void M() {
		$F(new string[0], n => 0)$;
	}
}";

			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.IsError, Is.False);
			replacedert.That(rr.Member, Is.InstanceOf<SpecializedMember>());
			replacedert.That(rr.Member.Parameters[0].Type.Kind == TypeKind.Array);
		}

19 View Source File : InvocationTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void OverloadResolutionWithDerivedTypesAndLambdas() {
			string program = @"using System;
public clreplaced C {
	clreplaced B {}
	clreplaced D : B {}

	static void F(B a, Func<B, object> f) {}
	static void F(D a, Func<D, object> f) {}

	public static void M(object obj) {
		$F(new D(), n => 0)$;
	}
}";
			var rr = Resolve<CSharpInvocationResolveResult>(program);
			replacedert.That(rr.IsError, Is.False);
			replacedert.That(rr.Member.Parameters[0].Type.Name == "D");
		}

19 View Source File : LambdaTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConversionInExplicitlyTypedLambdaBody() {
			string program = @"using System;
clreplaced Test {
	public object M() {
		System.Func<int, string> f = $(int i) => null$;
	}
}";
			var rr = Resolve<LambdaResolveResult>(program);
			replacedert.IsInstanceOf<ConversionResolveResult>(rr.Body);
			replacedert.That(((ConversionResolveResult)rr.Body).Conversion.IsNullLiteralConversion);
			replacedert.AreEqual("System.String", rr.ReturnType.ReflectionName);
			replacedert.AreEqual("System.String", rr.Body.Type.ReflectionName);
		}

19 View Source File : LambdaTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void ConversionInImplicitlyTypedLambdaBody() {
			string program = @"using System;
clreplaced Test {
	public object M() {
		System.Func<int, string> f = $i => null$;
	}
}";
			var rr = Resolve<LambdaResolveResult>(program);
			replacedert.IsInstanceOf<ConversionResolveResult>(rr.Body);
			replacedert.That(((ConversionResolveResult)rr.Body).Conversion.IsNullLiteralConversion);
			replacedert.AreEqual("System.String", rr.ReturnType.ReflectionName);
			replacedert.AreEqual("System.String", rr.Body.Type.ReflectionName);
		}

19 View Source File : MultiResolutionImageTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void Load_returns_correct_image_version_for_various_optimal_scale_factors()
		{
			var x1Stream = new MemoryStream();
			var x2Stream = new MemoryStream();
			var multiResImage = new MultiResolutionImage(
				new[]
				{
					new ImageStream(1.0, () => x1Stream),
					new ImageStream(2.0, () => x2Stream)
				});
			var iv0_5 = multiResImage.Load<Stream>(0.5, cache: false);
			replacedert.That(iv0_5.ScaleFactor.Value, Is.EqualTo(1.0));
			replacedert.That(ReferenceEquals(iv0_5.Image, x1Stream));

			var iv1 = multiResImage.Load<Stream>(1, cache: false);
			replacedert.That(iv1.ScaleFactor.Value, Is.EqualTo(1.0));
			replacedert.That(ReferenceEquals(iv1.Image, x1Stream));

			var iv1_5 = multiResImage.Load<Stream>(1.5, cache: false);
			replacedert.That(iv1_5.ScaleFactor.Value, Is.EqualTo(2.0));
			replacedert.That(ReferenceEquals(iv1_5.Image, x2Stream));

			var iv2 = multiResImage.Load<Stream>(2, cache: false);
			replacedert.That(iv2.ScaleFactor.Value, Is.EqualTo(2.0));
			replacedert.That(ReferenceEquals(iv2.Image, x2Stream));

			var iv3 = multiResImage.Load<Stream>(3, cache: false);
			replacedert.That(iv3.ScaleFactor.Value, Is.EqualTo(2.0));
			replacedert.That(ReferenceEquals(iv3.Image, x2Stream));
		}

19 View Source File : ConverterTests.cs
License : MIT License
Project Creator : fuse-open

[Test]
		public void CanBeCalledTwice()
		{
			var log = new MessageListLogger();
			var converter = new Converter(new SketchParser(log), new SymbolsUxBuilder(log), log);
			var arrowSketch = Path.Combine(FilesDirectory, "Arrow.sketch");
			replacedert.That(File.Exists(arrowSketch));
			converter.Convert(new [] {arrowSketch}, TempDirectory);
			replacedert.That(log.ErrorsAndWarnings(), Is.Empty);
			converter.Convert(new [] {arrowSketch}, TempDirectory);
			replacedert.That(log.ErrorsAndWarnings(), Is.Empty);
		}

19 View Source File : DocumentBuilder.cs
License : MIT License
Project Creator : fuse-open

public static SketchDoreplacedent WithSymbol(this SketchDoreplacedent doreplacedent, SketchSymbolMaster symbol)
		{
			// Fixme just find the Symbols page
			replacedert.That(doreplacedent.Pages.Count == 1);
			replacedert.That(doreplacedent.Pages.First().Name == "Symbols");
			var firstPage = doreplacedent.Pages.First();
			var newLayers = new List<SketchLayer>(firstPage.Layers) {symbol};
			var newPage = new SketchPage(Guid.NewGuid(), firstPage.Frame, firstPage.Name, newLayers);
			return new SketchDoreplacedent(doreplacedent.Id, new List<SketchPage>{newPage});
		}

19 View Source File : IRepositoryManagerListener.cs
License : MIT License
Project Creator : github-for-unity

public static void replacedertDidNotReceiveAnyCalls(this IRepositoryManagerListener repositoryManagerListener)
        {
            replacedert.That(repositoryManagerListener.ReceivedCalls().Count() == 0);
            //repositoryManagerListener.DidNotReceive().OnIsBusyChanged(Args.Bool);
            //repositoryManagerListener.DidNotReceive().CurrentBranchUpdated(Args.NullableConfigBranch, Args.NullableConfigRemote);
            //repositoryManagerListener.DidNotReceive().GitAheadBehindStatusUpdated(Args.GitAheadBehindStatus);
            //repositoryManagerListener.DidNotReceive().GitStatusUpdated(Args.GitStatus);
            //repositoryManagerListener.DidNotReceive().GitLocksUpdated(Args.GitLocks);
            //repositoryManagerListener.DidNotReceive().GitLogUpdated(Args.GitLogs);
            //repositoryManagerListener.DidNotReceive().LocalBranchesUpdated(Args.LocalBranchDictionary);
            //repositoryManagerListener.DidNotReceive().RemoteBranchesUpdated(Args.RemoteDictionary, Args.RemoteBranchDictionary);
        }

19 View Source File : InventoryArchiverTests.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : HalcyonGrid

[Test]
        public void TestLoadIarV0p1TempProfiles()
        {   
            replacedert.Ignore();
            TestHelper.InMethod();
            Console.WriteLine("### Started {0} ###", MethodBase.GetCurrentMethod());
            
            log4net.Config.XmlConfigurator.Configure();
            
            string userFirstName = "Dennis";
            string userLastName = "Menace";
            UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa");
            string user2FirstName = "Walter";
            string user2LastName = "Mitty";
            
            string itemName = "b.lsl";
            string archiveItemName
                = string.Format("{0}{1}{2}", itemName, "_", UUID.Random());            

            MemoryStream archiveWriteStream = new MemoryStream();
            TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);

            InventoryItemBase item1 = new InventoryItemBase();
            item1.Name = itemName;
            item1.replacedetID = UUID.Random();
            item1.GroupID = UUID.Random();
            item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
            item1.Owner = UUID.Zero;
            
            string item1FileName 
                = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
            tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
            tar.Close();

            MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());            
            SerialiserModule serialiserModule = new SerialiserModule();
            InventoryArchiverModule archiverModule = new InventoryArchiverModule();
            
            // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
            Scene scene = SceneSetupHelpers.SetupScene();
            IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
            
            SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
            userAdminService.AddUser(
                userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
            
            archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
            
            // Check that a suitable temporary user profile has been created.
            UserProfileData user2Profile 
                = scene.CommsManager.UserService.GetUserProfile(
                    OspResolver.HashName(user2FirstName + " " + user2LastName));
            replacedert.That(user2Profile, Is.Not.Null);
            replacedert.That(user2Profile.FirstName == user2FirstName);
            replacedert.That(user2Profile.SurName == user2LastName);
            
            CachedUserInfo userInfo 
                = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);            
            InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
            
            replacedert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId));
            replacedert.That(
                foundItem.CreatorIdAsUuid, Is.EqualTo(OspResolver.HashName(user2FirstName + " " + user2LastName)));
            replacedert.That(foundItem.Owner, Is.EqualTo(userUuid));
            
            Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
        }

19 View Source File : FieldTests.cs
License : MIT License
Project Creator : Jamiras

[Test]
        public void TestEquals()
        {
            var field1 = new Field { Size = FieldSize.Byte, Type = FieldType.MemoryAddress, Value = 0x1234 };
            var field2 = new Field { Size = FieldSize.Byte, Type = FieldType.MemoryAddress, Value = 0x1234 };

            replacedert.That(field1, Is.EqualTo(field2));
            replacedert.That(field1 == field2);
            replacedert.That(field1.Equals(field2));
        }

See More Examples