diff --git a/.editorconfig b/.editorconfig index 3a2d4f8ebd..ee3eb6c50b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -157,6 +157,279 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_space_between_square_brackets = false +# analyzers +dotnet_diagnostic.AvoidAsyncVoid.severity = suggestion + +dotnet_diagnostic.CA1000.severity = none +dotnet_diagnostic.CA1001.severity = error +dotnet_diagnostic.CA1009.severity = error +dotnet_diagnostic.CA1016.severity = error +dotnet_diagnostic.CA1030.severity = none +dotnet_diagnostic.CA1031.severity = none +dotnet_diagnostic.CA1033.severity = none +dotnet_diagnostic.CA1036.severity = none +dotnet_diagnostic.CA1049.severity = error +dotnet_diagnostic.CA1056.severity = suggestion +dotnet_diagnostic.CA1060.severity = error +dotnet_diagnostic.CA1061.severity = error +dotnet_diagnostic.CA1063.severity = error +dotnet_diagnostic.CA1065.severity = error +dotnet_diagnostic.CA1301.severity = error +dotnet_diagnostic.CA1303.severity = none +dotnet_diagnostic.CA1308.severity = none +dotnet_diagnostic.CA1400.severity = error +dotnet_diagnostic.CA1401.severity = error +dotnet_diagnostic.CA1403.severity = error +dotnet_diagnostic.CA1404.severity = error +dotnet_diagnostic.CA1405.severity = error +dotnet_diagnostic.CA1410.severity = error +dotnet_diagnostic.CA1415.severity = error +dotnet_diagnostic.CA1507.severity = error +dotnet_diagnostic.CA1710.severity = suggestion +dotnet_diagnostic.CA1724.severity = none +dotnet_diagnostic.CA1810.severity = none +dotnet_diagnostic.CA1821.severity = error +dotnet_diagnostic.CA1900.severity = error +dotnet_diagnostic.CA1901.severity = error +dotnet_diagnostic.CA2000.severity = none +dotnet_diagnostic.CA2002.severity = error +dotnet_diagnostic.CA2007.severity = none +dotnet_diagnostic.CA2100.severity = error +dotnet_diagnostic.CA2101.severity = error +dotnet_diagnostic.CA2108.severity = error +dotnet_diagnostic.CA2111.severity = error +dotnet_diagnostic.CA2112.severity = error +dotnet_diagnostic.CA2114.severity = error +dotnet_diagnostic.CA2116.severity = error +dotnet_diagnostic.CA2117.severity = error +dotnet_diagnostic.CA2122.severity = error +dotnet_diagnostic.CA2123.severity = error +dotnet_diagnostic.CA2124.severity = error +dotnet_diagnostic.CA2126.severity = error +dotnet_diagnostic.CA2131.severity = error +dotnet_diagnostic.CA2132.severity = error +dotnet_diagnostic.CA2133.severity = error +dotnet_diagnostic.CA2134.severity = error +dotnet_diagnostic.CA2137.severity = error +dotnet_diagnostic.CA2138.severity = error +dotnet_diagnostic.CA2140.severity = error +dotnet_diagnostic.CA2141.severity = error +dotnet_diagnostic.CA2146.severity = error +dotnet_diagnostic.CA2147.severity = error +dotnet_diagnostic.CA2149.severity = error +dotnet_diagnostic.CA2200.severity = error +dotnet_diagnostic.CA2202.severity = error +dotnet_diagnostic.CA2207.severity = error +dotnet_diagnostic.CA2212.severity = error +dotnet_diagnostic.CA2213.severity = error +dotnet_diagnostic.CA2214.severity = error +dotnet_diagnostic.CA2216.severity = error +dotnet_diagnostic.CA2220.severity = error +dotnet_diagnostic.CA2229.severity = error +dotnet_diagnostic.CA2231.severity = error +dotnet_diagnostic.CA2232.severity = error +dotnet_diagnostic.CA2235.severity = error +dotnet_diagnostic.CA2236.severity = error +dotnet_diagnostic.CA2237.severity = error +dotnet_diagnostic.CA2238.severity = error +dotnet_diagnostic.CA2240.severity = error +dotnet_diagnostic.CA2241.severity = error +dotnet_diagnostic.CA2242.severity = error + +dotnet_diagnostic.RCS1001.severity = error +dotnet_diagnostic.RCS1018.severity = error +dotnet_diagnostic.RCS1037.severity = error +dotnet_diagnostic.RCS1055.severity = error +dotnet_diagnostic.RCS1062.severity = error +dotnet_diagnostic.RCS1066.severity = error +dotnet_diagnostic.RCS1069.severity = error +dotnet_diagnostic.RCS1071.severity = error +dotnet_diagnostic.RCS1074.severity = error +dotnet_diagnostic.RCS1090.severity = error +dotnet_diagnostic.RCS1138.severity = error +dotnet_diagnostic.RCS1139.severity = error +dotnet_diagnostic.RCS1163.severity = suggestion +dotnet_diagnostic.RCS1168.severity = suggestion +dotnet_diagnostic.RCS1188.severity = error +dotnet_diagnostic.RCS1201.severity = error +dotnet_diagnostic.RCS1207.severity = error +dotnet_diagnostic.RCS1211.severity = error +dotnet_diagnostic.RCS1507.severity = error + +dotnet_diagnostic.SA1000.severity = error +dotnet_diagnostic.SA1001.severity = error +dotnet_diagnostic.SA1002.severity = error +dotnet_diagnostic.SA1003.severity = error +dotnet_diagnostic.SA1004.severity = error +dotnet_diagnostic.SA1005.severity = error +dotnet_diagnostic.SA1006.severity = error +dotnet_diagnostic.SA1007.severity = error +dotnet_diagnostic.SA1008.severity = error +dotnet_diagnostic.SA1009.severity = error +dotnet_diagnostic.SA1010.severity = error +dotnet_diagnostic.SA1011.severity = error +dotnet_diagnostic.SA1012.severity = error +dotnet_diagnostic.SA1013.severity = error +dotnet_diagnostic.SA1014.severity = error +dotnet_diagnostic.SA1015.severity = error +dotnet_diagnostic.SA1016.severity = error +dotnet_diagnostic.SA1017.severity = error +dotnet_diagnostic.SA1018.severity = error +dotnet_diagnostic.SA1019.severity = error +dotnet_diagnostic.SA1020.severity = error +dotnet_diagnostic.SA1021.severity = error +dotnet_diagnostic.SA1022.severity = error +dotnet_diagnostic.SA1023.severity = error +dotnet_diagnostic.SA1024.severity = error +dotnet_diagnostic.SA1025.severity = error +dotnet_diagnostic.SA1026.severity = error +dotnet_diagnostic.SA1027.severity = error +dotnet_diagnostic.SA1028.severity = error +dotnet_diagnostic.SA1100.severity = error +dotnet_diagnostic.SA1101.severity = none +dotnet_diagnostic.SA1102.severity = error +dotnet_diagnostic.SA1103.severity = error +dotnet_diagnostic.SA1104.severity = error +dotnet_diagnostic.SA1105.severity = error +dotnet_diagnostic.SA1106.severity = error +dotnet_diagnostic.SA1107.severity = error +dotnet_diagnostic.SA1108.severity = error +dotnet_diagnostic.SA1110.severity = error +dotnet_diagnostic.SA1111.severity = error +dotnet_diagnostic.SA1112.severity = error +dotnet_diagnostic.SA1113.severity = error +dotnet_diagnostic.SA1114.severity = error +dotnet_diagnostic.SA1115.severity = error +dotnet_diagnostic.SA1116.severity = error +dotnet_diagnostic.SA1117.severity = error +dotnet_diagnostic.SA1118.severity = error +dotnet_diagnostic.SA1119.severity = error +dotnet_diagnostic.SA1120.severity = error +dotnet_diagnostic.SA1121.severity = error +dotnet_diagnostic.SA1122.severity = error +dotnet_diagnostic.SA1123.severity = error +dotnet_diagnostic.SA1124.severity = error +dotnet_diagnostic.SA1125.severity = error +dotnet_diagnostic.SA1127.severity = error +dotnet_diagnostic.SA1128.severity = error +dotnet_diagnostic.SA1129.severity = error +dotnet_diagnostic.SA1130.severity = error +dotnet_diagnostic.SA1131.severity = error +dotnet_diagnostic.SA1132.severity = error +dotnet_diagnostic.SA1133.severity = error +dotnet_diagnostic.SA1134.severity = error +dotnet_diagnostic.SA1135.severity = error +dotnet_diagnostic.SA1136.severity = error +dotnet_diagnostic.SA1137.severity = error +dotnet_diagnostic.SA1139.severity = error +dotnet_diagnostic.SA1200.severity = none +dotnet_diagnostic.SA1201.severity = error +dotnet_diagnostic.SA1202.severity = error +dotnet_diagnostic.SA1203.severity = error +dotnet_diagnostic.SA1204.severity = error +dotnet_diagnostic.SA1205.severity = error +dotnet_diagnostic.SA1206.severity = error +dotnet_diagnostic.SA1207.severity = error +dotnet_diagnostic.SA1208.severity = error +dotnet_diagnostic.SA1209.severity = error +dotnet_diagnostic.SA1210.severity = error +dotnet_diagnostic.SA1211.severity = error +dotnet_diagnostic.SA1212.severity = error +dotnet_diagnostic.SA1213.severity = error +dotnet_diagnostic.SA1214.severity = error +dotnet_diagnostic.SA1216.severity = error +dotnet_diagnostic.SA1217.severity = error +dotnet_diagnostic.SA1300.severity = error +dotnet_diagnostic.SA1302.severity = error +dotnet_diagnostic.SA1303.severity = error +dotnet_diagnostic.SA1304.severity = error +dotnet_diagnostic.SA1306.severity = none +dotnet_diagnostic.SA1307.severity = error +dotnet_diagnostic.SA1308.severity = error +dotnet_diagnostic.SA1309.severity = none +dotnet_diagnostic.SA1310.severity = error +dotnet_diagnostic.SA1311.severity = none +dotnet_diagnostic.SA1312.severity = error +dotnet_diagnostic.SA1313.severity = error +dotnet_diagnostic.SA1314.severity = error +dotnet_diagnostic.SA1316.severity = none +dotnet_diagnostic.SA1400.severity = error +dotnet_diagnostic.SA1401.severity = error +dotnet_diagnostic.SA1402.severity = error +dotnet_diagnostic.SA1403.severity = error +dotnet_diagnostic.SA1404.severity = error +dotnet_diagnostic.SA1405.severity = error +dotnet_diagnostic.SA1406.severity = error +dotnet_diagnostic.SA1407.severity = error +dotnet_diagnostic.SA1408.severity = error +dotnet_diagnostic.SA1410.severity = error +dotnet_diagnostic.SA1411.severity = error +dotnet_diagnostic.SA1413.severity = none +dotnet_diagnostic.SA1500.severity = error +dotnet_diagnostic.SA1501.severity = error +dotnet_diagnostic.SA1502.severity = error +dotnet_diagnostic.SA1503.severity = error +dotnet_diagnostic.SA1504.severity = error +dotnet_diagnostic.SA1505.severity = error +dotnet_diagnostic.SA1506.severity = error +dotnet_diagnostic.SA1507.severity = error +dotnet_diagnostic.SA1508.severity = error +dotnet_diagnostic.SA1509.severity = error +dotnet_diagnostic.SA1510.severity = error +dotnet_diagnostic.SA1511.severity = error +dotnet_diagnostic.SA1512.severity = error +dotnet_diagnostic.SA1513.severity = error +dotnet_diagnostic.SA1514.severity = error +dotnet_diagnostic.SA1515.severity = error +dotnet_diagnostic.SA1516.severity = error +dotnet_diagnostic.SA1517.severity = error +dotnet_diagnostic.SA1518.severity = error +dotnet_diagnostic.SA1519.severity = error +dotnet_diagnostic.SA1520.severity = error +dotnet_diagnostic.SA1600.severity = error +dotnet_diagnostic.SA1601.severity = error +dotnet_diagnostic.SA1602.severity = error +dotnet_diagnostic.SA1604.severity = error +dotnet_diagnostic.SA1605.severity = error +dotnet_diagnostic.SA1606.severity = error +dotnet_diagnostic.SA1607.severity = error +dotnet_diagnostic.SA1608.severity = error +dotnet_diagnostic.SA1610.severity = error +dotnet_diagnostic.SA1611.severity = error +dotnet_diagnostic.SA1612.severity = error +dotnet_diagnostic.SA1613.severity = error +dotnet_diagnostic.SA1614.severity = error +dotnet_diagnostic.SA1615.severity = error +dotnet_diagnostic.SA1616.severity = error +dotnet_diagnostic.SA1617.severity = error +dotnet_diagnostic.SA1618.severity = error +dotnet_diagnostic.SA1619.severity = error +dotnet_diagnostic.SA1620.severity = error +dotnet_diagnostic.SA1621.severity = error +dotnet_diagnostic.SA1622.severity = error +dotnet_diagnostic.SA1623.severity = error +dotnet_diagnostic.SA1624.severity = error +dotnet_diagnostic.SA1625.severity = error +dotnet_diagnostic.SA1626.severity = error +dotnet_diagnostic.SA1627.severity = error +dotnet_diagnostic.SA1629.severity = error +dotnet_diagnostic.SA1633.severity = error +dotnet_diagnostic.SA1634.severity = error +dotnet_diagnostic.SA1635.severity = error +dotnet_diagnostic.SA1636.severity = error +dotnet_diagnostic.SA1637.severity = none +dotnet_diagnostic.SA1638.severity = none +dotnet_diagnostic.SA1640.severity = error +dotnet_diagnostic.SA1641.severity = error +dotnet_diagnostic.SA1642.severity = error +dotnet_diagnostic.SA1643.severity = error +dotnet_diagnostic.SA1649.severity = error +dotnet_diagnostic.SA1651.severity = error + +dotnet_diagnostic.SX1101.severity = error +dotnet_diagnostic.SX1309.severity = error +dotnet_diagnostic.SX1623.severity = none + # C++ Files [*.{cpp,h,in}] curly_bracket_next_line = true diff --git a/src/Directory.build.props b/src/Directory.build.props index fdb7a865be..3397dca3b7 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -1,12 +1,9 @@ true - $(NoWarn);1591;1701;1702;1705;VSX1000 AnyCPU $(MSBuildProjectName.Contains('Tests')) embedded - $(MSBuildThisFileDirectory)analyzers.ruleset - .NET Foundation and Contributors Copyright (c) .NET Foundation and Contributors MIT @@ -36,9 +33,8 @@ Full - - $(MSBuildThisFileDirectory)analyzers.tests.ruleset - false + + false diff --git a/src/ReactiveUI.Fody.Analyzer.Test/Helpers/DiagnosticResultLocation.cs b/src/ReactiveUI.Fody.Analyzer.Test/Helpers/DiagnosticResultLocation.cs index c3396aad8c..d8935a44be 100644 --- a/src/ReactiveUI.Fody.Analyzer.Test/Helpers/DiagnosticResultLocation.cs +++ b/src/ReactiveUI.Fody.Analyzer.Test/Helpers/DiagnosticResultLocation.cs @@ -58,6 +58,14 @@ public DiagnosticResultLocation(string path, int line, int column) /// Are Equal. public static bool operator ==(DiagnosticResultLocation left, DiagnosticResultLocation right) => left.Equals(right); + /// + /// Implements the operator !=. + /// + /// The left. + /// The right. + /// + /// The result of the operator. + /// public static bool operator !=(DiagnosticResultLocation left, DiagnosticResultLocation right) => !left.Equals(right); /// diff --git a/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.cs b/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.cs index 7c63fbd620..54768fb9eb 100644 --- a/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.cs +++ b/src/ReactiveUI.Fody.Tests/API/ApiApprovalTests.cs @@ -12,9 +12,18 @@ namespace ReactiveUI.Fody.Tests.API { + /// + /// Tests for checking if the Fody public API is not changing. + /// We have a file checked into the repository with the approved public API. + /// If it is changing you'll need to override to make it obvious the API has changed + /// for version changing reasons. + /// [ExcludeFromCodeCoverage] public class ApiApprovalTests : ApiApprovalBase { + /// + /// Checks the version API. + /// [Fact] public void ReactiveUIFody() => CheckApproval(typeof(ReactiveAttribute).Assembly); } diff --git a/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs b/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs index de13221ca3..20cc3af022 100644 --- a/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs +++ b/src/ReactiveUI.Fody.Tests/ApiApprovalBase.cs @@ -20,11 +20,20 @@ namespace ReactiveUI.Fody.Tests { + /// + /// Tests for API approvals. + /// [ExcludeFromCodeCoverage] public abstract class ApiApprovalBase { private static readonly Regex _removeCoverletSectionRegex = new(@"^namespace Coverlet\.Core\.Instrumentation\.Tracker.*?^}", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.Compiled); + /// + /// Checks the assembly to detect the public API. Generates a received/approved version of the API. + /// + /// The assembly to check. + /// Auto populated member name. + /// Auto populated file path. protected static void CheckApproval(Assembly assembly, [CallerMemberName]string? memberName = null, [CallerFilePath]string? filePath = null) { var targetFrameworkName = Assembly.GetExecutingAssembly().GetTargetFrameworkName(); @@ -61,7 +70,7 @@ private static string Filter(string text) return string.Join(Environment.NewLine, text.Split( new[] { - Environment.NewLine + Environment.NewLine, }, StringSplitOptions.RemoveEmptyEntries) .Where(l => diff --git a/src/ReactiveUI.Fody.Tests/Issues/Issue13Tests.cs b/src/ReactiveUI.Fody.Tests/Issues/ChainExpressionTests.cs similarity index 72% rename from src/ReactiveUI.Fody.Tests/Issues/Issue13Tests.cs rename to src/ReactiveUI.Fody.Tests/Issues/ChainExpressionTests.cs index 76971a5ee2..174d9add54 100644 --- a/src/ReactiveUI.Fody.Tests/Issues/Issue13Tests.cs +++ b/src/ReactiveUI.Fody.Tests/Issues/ChainExpressionTests.cs @@ -14,18 +14,24 @@ namespace ReactiveUI.Fody.Tests.Issues { - public class Issue13Tests + /// + /// Tests for determining if a chain expression works. + /// + public class ChainExpressionTests { + /// + /// Checks to make sure that if double property chaining doesn't cause a exception. + /// [Fact] public void AccessingAChainedObservableAsPropertyOfDoubleDoesntThrow() { - var vm = new VM(); + var vm = new TestModel(); Assert.Equal(0.0, vm.P2); } - private class VM : ReactiveObject + private class TestModel : ReactiveObject { - public VM() + public TestModel() { Observable.Return(0.0).ToPropertyEx(this, vm => vm.P1); this.WhenAnyValue(vm => vm.P1).ToPropertyEx(this, vm => vm.P2); diff --git a/src/ReactiveUI.Fody.Tests/Issues/ExternPropertyTests.cs b/src/ReactiveUI.Fody.Tests/Issues/ExternPropertyTests.cs new file mode 100644 index 0000000000..5f78d4f724 --- /dev/null +++ b/src/ReactiveUI.Fody.Tests/Issues/ExternPropertyTests.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using System.Reactive.Linq; + +using ReactiveUI.Fody.Helpers; + +using Xunit; + +namespace ReactiveUI.Fody.Tests.Issues +{ + /// + /// Checks to make sure that extern properties work. + /// + public class ExternPropertyTests + { + /// + /// Checks that observables passed as a parameter are supported. + /// + [Fact] + public void AllowObservableAsPropertyAttributeOnAccessor() + { + var model = new TestModel("foo"); + Assert.Equal("foo", model.MyProperty); + } + + private class TestModel : ReactiveObject + { + public TestModel(string myProperty) => Observable.Return(myProperty).ToPropertyEx(this, x => x.MyProperty); + + public extern string MyProperty + { + [ObservableAsProperty] + get; + } + } + } +} diff --git a/src/ReactiveUI.Fody.Tests/Issues/Issue11Tests.cs b/src/ReactiveUI.Fody.Tests/Issues/Issue11Tests.cs deleted file mode 100644 index 678fa4e7b3..0000000000 --- a/src/ReactiveUI.Fody.Tests/Issues/Issue11Tests.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using System.Reactive.Linq; -using ReactiveUI.Fody.Helpers; -using Xunit; - -namespace ReactiveUI.Fody.Tests.Issues -{ - public class Issue11Tests - { - [Fact] - public void AllowObservableAsPropertyAttributeOnAccessor() - { - var model = new Issue11TestModel("foo"); - Assert.Equal("foo", model.MyProperty); - } - } -} diff --git a/src/ReactiveUI.Fody.Tests/Issues/Mocks/Issue11TestModel.cs b/src/ReactiveUI.Fody.Tests/Issues/Mocks/Issue11TestModel.cs deleted file mode 100644 index 353d096271..0000000000 --- a/src/ReactiveUI.Fody.Tests/Issues/Mocks/Issue11TestModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reactive.Linq; -using System.Text; -using System.Threading.Tasks; -using ReactiveUI.Fody.Helpers; - -namespace ReactiveUI.Fody.Tests.Issues -{ - public class Issue11TestModel : ReactiveObject - { - public Issue11TestModel(string myProperty) => Observable.Return(myProperty).ToPropertyEx(this, x => x.MyProperty); - - public extern string MyProperty - { - [ObservableAsProperty] - get; - } - } -} diff --git a/src/ReactiveUI.Fody.Tests/Issues/Issue47Tests.cs b/src/ReactiveUI.Fody.Tests/Issues/NumericValueWorkTests.cs similarity index 54% rename from src/ReactiveUI.Fody.Tests/Issues/Issue47Tests.cs rename to src/ReactiveUI.Fody.Tests/Issues/NumericValueWorkTests.cs index b575ba95d6..412f78feff 100644 --- a/src/ReactiveUI.Fody.Tests/Issues/Issue47Tests.cs +++ b/src/ReactiveUI.Fody.Tests/Issues/NumericValueWorkTests.cs @@ -1,20 +1,38 @@ -// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved. +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. using System.Diagnostics.CodeAnalysis; + +using FluentAssertions; + using ReactiveUI.Fody.Helpers; namespace ReactiveUI.Fody.Tests.Issues { - public static class Issue47Tests + /// + /// A set of tests to make sure that they produce valid numeric values for different types. + /// + public class NumericValueWorkTests { + /// + /// A test to make sure that all the default values are kept after generation. + /// + public void KeepsDefaultValuesTest() + { + var testModel = new TestModel(); + + testModel.DoubleProperty.Should().Be(default(double)); + testModel.IntProperty.Should().Be(default(int)); + testModel.FloatProperty.Should().Be(default(float)); + testModel.LongProperty.Should().Be(default(long)); + } + /// /// The "test" here is simply for these to compile /// Tests ObservableAsPropertyWeaver.EmitDefaultValue. /// - [SuppressMessage("Microsoft.Performance", "CA1812: Avoid uninstantiated internal classes", Justification = "Purpose is just to be compiled.")] private class TestModel : ReactiveObject { [ObservableAsProperty] diff --git a/src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs b/src/ReactiveUI.Fody.Tests/Issues/UninitializedValuesWorkTests.cs similarity index 79% rename from src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs rename to src/ReactiveUI.Fody.Tests/Issues/UninitializedValuesWorkTests.cs index d78fd3cdff..8729480b9e 100644 --- a/src/ReactiveUI.Fody.Tests/Issues/Issue10Tests.cs +++ b/src/ReactiveUI.Fody.Tests/Issues/UninitializedValuesWorkTests.cs @@ -9,8 +9,14 @@ namespace ReactiveUI.Fody.Tests.Issues { - public class Issue10Tests + /// + /// Makes sure that uninitialized values, which don't have ToPropertyEx called work. + /// + public class UninitializedValuesWorkTests { + /// + /// Test to make sure that properties without PropertyHelper return the correct value. + /// [Fact] public void UninitializedObservableAsPropertyHelperDoesntThrowAndReturnsDefaultValue() { diff --git a/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs index bcb9994aee..df02451ef7 100644 --- a/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs +++ b/src/ReactiveUI.Fody.Tests/Mocks/BaseModel.cs @@ -11,10 +11,19 @@ namespace ReactiveUI.Fody.Tests { + /// + /// A base model for the mocks. + /// public class BaseModel : ReactiveObject { + /// + /// Gets or sets a integer property with a initial value. + /// public virtual int IntProperty { get; set; } = 5; + /// + /// Gets or sets a string property with a initial value. + /// public virtual string? StringProperty { get; set; } = "Initial Value"; } } diff --git a/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs index 795b1f9b67..8c25c6dcc6 100644 --- a/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs +++ b/src/ReactiveUI.Fody.Tests/Mocks/DecoratorModel.cs @@ -12,23 +12,39 @@ namespace ReactiveUI.Fody.Tests { + /// + /// A view model that is decorated with rx fody attributes. + /// public class DecoratorModel : BaseModel { private readonly BaseModel _model; - // Testing ctor + /// + /// Initializes a new instance of the class. + /// public DecoratorModel() => _model = new BaseModel(); + /// + /// Initializes a new instance of the class. + /// + /// The base model which to do ReactiveDependency off. public DecoratorModel(BaseModel baseModel) => _model = baseModel; + /// + /// Gets or sets a property decorated with the ReactiveAttribute. + /// [Reactive] public string? SomeCoolNewProperty { get; set; } - // Works with private fields + /// + /// Gets or sets a property decorated with the ReactiveDependencyAttribute. + /// [ReactiveDependency(nameof(_model))] public override string? StringProperty { get; set; } - // Can't be attributed as has additional functionality in the decorated get + /// + /// Gets or sets a property which interacts with the base model. + /// public override int IntProperty { get => _model.IntProperty * 2; @@ -39,6 +55,10 @@ public override int IntProperty } } + /// + /// Sets the string. This is independent of the fody generation. + /// + /// The new value to set. public void UpdateCoolProperty(string coolNewProperty) => SomeCoolNewProperty = coolNewProperty; } } diff --git a/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs index cd165b8a7d..7b42bed91d 100644 --- a/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs +++ b/src/ReactiveUI.Fody.Tests/Mocks/FacadeModel.cs @@ -12,25 +12,42 @@ namespace ReactiveUI.Fody.Tests { + /// + /// A model which is facading another object. + /// public class FacadeModel : ReactiveObject { private BaseModel _dependency; + /// + /// Initializes a new instance of the class. + /// public FacadeModel() => _dependency = new BaseModel(); + /// + /// Initializes a new instance of the class. + /// + /// The dependency to base again. public FacadeModel(BaseModel dependency) => _dependency = dependency; + /// + /// Gets the base dependency. + /// public BaseModel Dependency { get => _dependency; private set => _dependency = value; } - // Property with the same name, will look for a like for like name on the named dependency + /// + /// Gets or sets a property with the same name in the dependency. + /// [ReactiveDependency(nameof(Dependency))] public int IntProperty { get; set; } - // Property named differently to that on the dependency but still pass through value + /// + /// Gets or sets a string value that will be generated to pass through and from the dependency. + /// [ReactiveDependency(nameof(Dependency), TargetProperty = "StringProperty")] public string? AnotherStringProperty { get; set; } } diff --git a/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs b/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs index 3285a76401..de23fd323b 100644 --- a/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs +++ b/src/ReactiveUI.Fody.Tests/Mocks/ObservableAsTestModel.cs @@ -13,10 +13,19 @@ namespace ReactiveUI.Fody.Tests { + /// + /// A test model for the ObservabeAsPropertyAttribute. + /// public class ObservableAsTestModel : ReactiveObject { + /// + /// Initializes a new instance of the class. + /// public ObservableAsTestModel() => Observable.Return("foo").ToPropertyEx(this, x => x.TestProperty); + /// + /// Gets the test property which will reference our generated observable. + /// [ObservableAsProperty] public string? TestProperty { get; private set; } } diff --git a/src/ReactiveUI.Fody.Tests/ObservableAsPropertyTests.cs b/src/ReactiveUI.Fody.Tests/ObservableAsPropertyTests.cs index 46073a81e7..0b7381e7a6 100644 --- a/src/ReactiveUI.Fody.Tests/ObservableAsPropertyTests.cs +++ b/src/ReactiveUI.Fody.Tests/ObservableAsPropertyTests.cs @@ -9,8 +9,14 @@ namespace ReactiveUI.Fody.Tests { + /// + /// Tests for the ObservableAsPropertyAttribute. + /// public class ObservableAsPropertyTests { + /// + /// Confirms the mock generated class returns the correct value. + /// [Fact] public void TestPropertyReturnsFoo() { diff --git a/src/ReactiveUI.Fody.Tests/ReactiveDependencyTests.cs b/src/ReactiveUI.Fody.Tests/ReactiveDependencyTests.cs index 6678492fdf..e969c351c1 100644 --- a/src/ReactiveUI.Fody.Tests/ReactiveDependencyTests.cs +++ b/src/ReactiveUI.Fody.Tests/ReactiveDependencyTests.cs @@ -9,8 +9,14 @@ namespace ReactiveUI.Fody.Tests { + /// + /// Tests for the ReactiveDependencyAttribute. + /// public class ReactiveDependencyTests { + /// + /// Tests to make sure that the facade returns the same valid as the dependency for the int property. + /// [Fact] public void IntPropertyOnWeavedFacadeReturnsBaseModelIntPropertyDefaultValueTest() { @@ -22,6 +28,9 @@ public void IntPropertyOnWeavedFacadeReturnsBaseModelIntPropertyDefaultValueTest Assert.Equal(expectedResult, facade.IntProperty); } + /// + /// Tests to make sure that the facade returns the same valid as the dependency for the string property. + /// [Fact] public void AnotherStringPropertyOnFacadeReturnsBaseModelStringPropertyDefaultValueTest() { @@ -33,6 +42,9 @@ public void AnotherStringPropertyOnFacadeReturnsBaseModelStringPropertyDefaultVa Assert.Equal(expectedResult, facade.AnotherStringProperty); } + /// + /// Tests to make sure that the facade returns the same valid as the dependency for the string property after being updated. + /// [Fact] public void SettingAnotherStringPropertyUpdatesTheDependencyStringProperty() { @@ -44,6 +56,9 @@ public void SettingAnotherStringPropertyUpdatesTheDependencyStringProperty() Assert.Equal(expectedResult, facade.Dependency.StringProperty); } + /// + /// Tests to make sure that the facade returns the same valid as the dependency for the int property after being updated. + /// [Fact] public void SettingFacadeIntPropertyUpdatesDependencyIntProperty() { @@ -55,6 +70,9 @@ public void SettingFacadeIntPropertyUpdatesDependencyIntProperty() Assert.Equal(expectedResult, facade.Dependency.IntProperty); } + /// + /// Checks to make sure that the property changed event is fired after first assignment. + /// [Fact] public void FacadeIntPropertyChangedEventFiresOnAssignmentTest() { @@ -71,6 +89,9 @@ public void FacadeIntPropertyChangedEventFiresOnAssignmentTest() Assert.Equal(expectedPropertyChanged, resultPropertyChanged); } + /// + /// Checks to make sure that the property changed event is fired after first assignment. + /// [Fact] public void FacadeAnotherStringPropertyChangedEventFiresOnAssignmentTest() { @@ -87,6 +108,9 @@ public void FacadeAnotherStringPropertyChangedEventFiresOnAssignmentTest() Assert.Equal(expectedPropertyChanged, resultPropertyChanged); } + /// + /// Checks to make sure that the facade and the decorate return the same value. + /// [Fact] public void StringPropertyOnWeavedDecoratorReturnsBaseModelDefaultStringValue() { @@ -98,6 +122,9 @@ public void StringPropertyOnWeavedDecoratorReturnsBaseModelDefaultStringValue() Assert.Equal(expectedResult, decorator.StringProperty); } + /// + /// Checks to make sure that the decorator property changed is fired. + /// [Fact] public void DecoratorStringPropertyRaisesPropertyChanged() { @@ -114,6 +141,9 @@ public void DecoratorStringPropertyRaisesPropertyChanged() Assert.Equal(expectedPropertyChanged, resultPropertyChanged); } + /// + /// Checks to make sure that the decorator property changed is fired. + /// [Fact] public void DecoratorReactiveStringPropertyRaisesPropertyChanged() { diff --git a/src/ReactiveUI.Splat.Tests/SplatAdapterTests.cs b/src/ReactiveUI.Splat.Tests/SplatAdapterTests.cs index df354625e9..e014a373c4 100644 --- a/src/ReactiveUI.Splat.Tests/SplatAdapterTests.cs +++ b/src/ReactiveUI.Splat.Tests/SplatAdapterTests.cs @@ -22,6 +22,9 @@ namespace ReactiveUI.Splat.Tests { + /// + /// Tests for checking the various adapters in splat. + /// public class SplatAdapterTests { /// diff --git a/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs b/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs index af8f305797..3bd8f9c6ec 100644 --- a/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs +++ b/src/ReactiveUI.Testing.Tests/TestFixtureBuilderExtensionTests.cs @@ -152,6 +152,10 @@ public void Should_Return_Count(int count) builder.Count.Should().Be(count); } + /// + /// A test to verify the name. + /// + /// The name. [Theory] [InlineData("ReactiveUI")] [InlineData("Splat")] diff --git a/src/ReactiveUI.Testing/SchedulerExtensions.cs b/src/ReactiveUI.Testing/SchedulerExtensions.cs index 21ba9f7128..5133986fff 100644 --- a/src/ReactiveUI.Testing/SchedulerExtensions.cs +++ b/src/ReactiveUI.Testing/SchedulerExtensions.cs @@ -13,11 +13,12 @@ namespace ReactiveUI.Testing { -#pragma warning disable SA1600 // Elements should be documented + /// + /// Extension methods for the test based schedulers. + /// public static class SchedulerExtensions -#pragma warning restore SA1600 // Elements should be documented { - private static readonly AutoResetEvent schedulerGate = new(true); + private static readonly AutoResetEvent _schedulerGate = new(true); /// /// WithScheduler overrides the default Deferred and Taskpool schedulers @@ -30,7 +31,7 @@ public static class SchedulerExtensions /// schedulers. public static IDisposable WithScheduler(IScheduler scheduler) { - schedulerGate.WaitOne(); + _schedulerGate.WaitOne(); var prevDef = RxApp.MainThreadScheduler; var prevTask = RxApp.TaskpoolScheduler; @@ -41,7 +42,7 @@ public static IDisposable WithScheduler(IScheduler scheduler) { RxApp.MainThreadScheduler = prevDef; RxApp.TaskpoolScheduler = prevTask; - schedulerGate.Set(); + _schedulerGate.Set(); }); } diff --git a/src/ReactiveUI.Tests/.editorconfig b/src/ReactiveUI.Tests/.editorconfig new file mode 100644 index 0000000000..e4bf081efe --- /dev/null +++ b/src/ReactiveUI.Tests/.editorconfig @@ -0,0 +1,3 @@ +# C# files +[*.cs] +dotnet_diagnostic.SA1600.severity = none diff --git a/src/ReactiveUI.Tests/API/ApiApprovalTests.cs b/src/ReactiveUI.Tests/API/ApiApprovalTests.cs index 6a76602d00..672204419c 100644 --- a/src/ReactiveUI.Tests/API/ApiApprovalTests.cs +++ b/src/ReactiveUI.Tests/API/ApiApprovalTests.cs @@ -10,12 +10,21 @@ namespace ReactiveUI.Tests.API { + /// + /// Checks to make sure that the API is consistent with previous releases, and new API changes are highlighted. + /// [ExcludeFromCodeCoverage] public class ApiApprovalTests : ApiApprovalBase { + /// + /// Generates public API for the ReactiveUI.Testing API. + /// [Fact] public void Testing() => CheckApproval(typeof(Testing.SchedulerExtensions).Assembly); + /// + /// Generates public API for the ReactiveUI API. + /// [Fact] public void ReactiveUI() => CheckApproval(typeof(RxApp).Assembly); } diff --git a/src/ReactiveUI.Tests/Activation/ActivatingView.cs b/src/ReactiveUI.Tests/Activation/ActivatingView.cs index d54ac0a58e..97a1baa204 100644 --- a/src/ReactiveUI.Tests/Activation/ActivatingView.cs +++ b/src/ReactiveUI.Tests/Activation/ActivatingView.cs @@ -10,10 +10,16 @@ namespace ReactiveUI.Tests { + /// + /// A view which simulates a activation. + /// public sealed class ActivatingView : ReactiveObject, IViewFor, IDisposable { private ActivatingViewModel? _viewModel; + /// + /// Initializes a new instance of the class. + /// public ActivatingView() => this.WhenActivated(d => { @@ -21,24 +27,42 @@ public ActivatingView() => d(Disposable.Create(() => IsActiveCount--)); }); + /// + /// Gets the loaded. + /// public Subject Loaded { get; } = new(); + /// + /// Gets the unloaded. + /// public Subject Unloaded { get; } = new(); + /// + /// Gets or sets the view model. + /// public ActivatingViewModel? ViewModel { get => _viewModel; set => this.RaiseAndSetIfChanged(ref _viewModel, value); } + /// + /// Gets or sets the view model. + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (ActivatingViewModel?)value; } + /// + /// Gets or sets the active count. + /// public int IsActiveCount { get; set; } + /// + /// Releases unmanaged and - optionally - managed resources. + /// public void Dispose() { Loaded.Dispose(); diff --git a/src/ReactiveUI.Tests/Activation/ActivatingViewFetcher.cs b/src/ReactiveUI.Tests/Activation/ActivatingViewFetcher.cs index 970f5191a2..eb8f77a1fd 100644 --- a/src/ReactiveUI.Tests/Activation/ActivatingViewFetcher.cs +++ b/src/ReactiveUI.Tests/Activation/ActivatingViewFetcher.cs @@ -8,10 +8,34 @@ namespace ReactiveUI.Tests { + /// + /// Simulates a activating view fetcher. + /// public class ActivatingViewFetcher : IActivationForViewFetcher { + /// + /// Determines the priority that the Activation View Fetcher + /// will be able to process the view type. + /// 0 means it cannot activate the View, value larger than 0 + /// indicates it can activate the View. + /// The class derived off IActivationForViewFetcher which returns + /// the highest affinity value will be used to activate the View. + /// + /// The type for the View. + /// + /// The affinity value which is equal to 0 or above. + /// public int GetAffinityForView(Type view) => view == typeof(ActivatingView) ? 100 : 0; + /// + /// Gets a Observable which will activate the View. + /// This is called after the GetAffinityForView method. + /// + /// The view to get the activation observable for. + /// + /// A Observable which will returns if Activation was successful. + /// + /// The view is null. public IObservable GetActivationForView(IActivatableView view) { if (!(view is ActivatingView av)) diff --git a/src/ReactiveUI.Tests/Activation/ActivatingViewModel.cs b/src/ReactiveUI.Tests/Activation/ActivatingViewModel.cs index 0931d24262..38cdc4118e 100644 --- a/src/ReactiveUI.Tests/Activation/ActivatingViewModel.cs +++ b/src/ReactiveUI.Tests/Activation/ActivatingViewModel.cs @@ -7,8 +7,14 @@ namespace ReactiveUI.Tests { + /// + /// Simulates a activating view model. + /// public class ActivatingViewModel : ReactiveObject, IActivatableViewModel { + /// + /// Initializes a new instance of the class. + /// public ActivatingViewModel() { Activator = new ViewModelActivator(); @@ -20,8 +26,14 @@ public ActivatingViewModel() }); } + /// + /// Gets or sets the Activator which will be used by the View when Activation/Deactivation occurs. + /// public ViewModelActivator Activator { get; protected set; } + /// + /// Gets or sets the active count. + /// public int IsActiveCount { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Activation/ActivatingViewModelTests.cs b/src/ReactiveUI.Tests/Activation/ActivatingViewModelTests.cs index 1a14067c2d..d63a3bb2d0 100644 --- a/src/ReactiveUI.Tests/Activation/ActivatingViewModelTests.cs +++ b/src/ReactiveUI.Tests/Activation/ActivatingViewModelTests.cs @@ -7,8 +7,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests associated with activating view models. + /// public class ActivatingViewModelTests { + /// + /// Tests for the activation to make sure it activates the appropriate number of times. + /// [Fact] public void ActivationsGetRefCounted() { @@ -29,6 +35,9 @@ public void ActivationsGetRefCounted() Assert.Equal(0, fixture.IsActiveCount); } + /// + /// Tests to make sure the activations of derived classes don't get stomped. + /// [Fact] public void DerivedActivationsDontGetStomped() { diff --git a/src/ReactiveUI.Tests/Activation/ActivatingViewTests.cs b/src/ReactiveUI.Tests/Activation/ActivatingViewTests.cs index 78b56bb8f7..fbeef360d4 100644 --- a/src/ReactiveUI.Tests/Activation/ActivatingViewTests.cs +++ b/src/ReactiveUI.Tests/Activation/ActivatingViewTests.cs @@ -9,8 +9,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for activating views. + /// public class ActivatingViewTests { + /// + /// Tests to make sure that views generally activate. + /// [Fact] public void ActivatingViewSmokeTest() { @@ -38,8 +44,11 @@ public void ActivatingViewSmokeTest() } } + /// + /// Tests for making sure nulling the view model deactivate it. + /// [Fact] - public void NullingViewModelShouldDeactivateIt() + public void NullingViewModelDeactivateIt() { var locator = new ModernDependencyResolver(); locator.InitializeSplat(); @@ -64,8 +73,11 @@ public void NullingViewModelShouldDeactivateIt() } } + /// + /// Tests switching the view model deactivates it. + /// [Fact] - public void SwitchingViewModelShouldDeactivateIt() + public void SwitchingViewModelDeactivatesIt() { var locator = new ModernDependencyResolver(); locator.InitializeSplat(); @@ -94,8 +106,11 @@ public void SwitchingViewModelShouldDeactivateIt() } } + /// + /// Tests setting the view model after loaded loads it. + /// [Fact] - public void SettingViewModelAfterLoadedShouldLoadIt() + public void SettingViewModelAfterLoadedLoadsIt() { var locator = new ModernDependencyResolver(); locator.InitializeSplat(); @@ -123,6 +138,9 @@ public void SettingViewModelAfterLoadedShouldLoadIt() } } + /// + /// Tests the can unload and load view again. + /// [Fact] public void CanUnloadAndLoadViewAgain() { diff --git a/src/ReactiveUI.Tests/Activation/CanActivateViewFetcherTests.cs b/src/ReactiveUI.Tests/Activation/CanActivateViewFetcherTests.cs index 57833e0a62..9fc9629222 100644 --- a/src/ReactiveUI.Tests/Activation/CanActivateViewFetcherTests.cs +++ b/src/ReactiveUI.Tests/Activation/CanActivateViewFetcherTests.cs @@ -11,26 +11,38 @@ namespace ReactiveUI.Tests { + /// + /// Tests to make sure the can activate view fetcher works correctly. + /// public class CanActivateViewFetcherTests { + /// + /// Tests return positive for ICanActivate. + /// [Fact] - public void ReturnsPositiveForICanActivate() + public void ReturnPositiveForICanActivate() { var canActivateViewFetcher = new CanActivateViewFetcher(); var affinity = canActivateViewFetcher.GetAffinityForView(typeof(ICanActivate)); Assert.True(affinity > 0); } + /// + /// Tests return positive for ICanActivate derivatives. + /// [Fact] - public void ReturnsPositiveForICanActivateDerivatives() + public void ReturnPositiveForICanActivateDerivatives() { var canActivateViewFetcher = new CanActivateViewFetcher(); var affinity = canActivateViewFetcher.GetAffinityForView(typeof(CanActivateStub)); Assert.True(affinity > 0); } + /// + /// Tests return zero for non ICanActivate derivatives. + /// [Fact] - public void ReturnsZeroForNonICanActivateDerivatives() + public void ReturnZeroForNonICanActivateDerivatives() { var canActivateViewFetcher = new CanActivateViewFetcher(); var affinity = canActivateViewFetcher.GetAffinityForView(typeof(CanActivateViewFetcherTests)); diff --git a/src/ReactiveUI.Tests/Activation/DerivedActivatingViewModel.cs b/src/ReactiveUI.Tests/Activation/DerivedActivatingViewModel.cs index 7cc832a9b1..a29621dca1 100644 --- a/src/ReactiveUI.Tests/Activation/DerivedActivatingViewModel.cs +++ b/src/ReactiveUI.Tests/Activation/DerivedActivatingViewModel.cs @@ -7,8 +7,14 @@ namespace ReactiveUI.Tests { + /// + /// A activating view model which is derived from another ActivatingViewModel. + /// public class DerivedActivatingViewModel : ActivatingViewModel { + /// + /// Initializes a new instance of the class. + /// public DerivedActivatingViewModel() => this.WhenActivated(d => { @@ -16,6 +22,9 @@ public DerivedActivatingViewModel() => d(Disposable.Create(() => IsActiveCountAlso--)); }); + /// + /// Gets or sets the active count. + /// public int IsActiveCountAlso { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Activation/ViewModelActivatorTests.cs b/src/ReactiveUI.Tests/Activation/ViewModelActivatorTests.cs index 80c7081a4a..657df635d9 100644 --- a/src/ReactiveUI.Tests/Activation/ViewModelActivatorTests.cs +++ b/src/ReactiveUI.Tests/Activation/ViewModelActivatorTests.cs @@ -10,10 +10,16 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the view model activator. + /// public class ViewModelActivatorTests { + /// + /// Tests the activating ticks activated observable. + /// [Fact] - public void ActivatingTicksActivatedObservable() + public void TestActivatingTicksActivatedObservable() { var viewModelActivator = new ViewModelActivator(); viewModelActivator.Activated.ToObservableChangeSet(ImmediateScheduler.Instance).Bind(out var activated).Subscribe(); @@ -23,8 +29,11 @@ public void ActivatingTicksActivatedObservable() Assert.Equal(1, activated.Count); } + /// + /// Tests the deactivating ignoring reference count ticks deactivated observable. + /// [Fact] - public void DeactivatingIgnoringRefCountTicksDeactivatedObservable() + public void TestDeactivatingIgnoringRefCountTicksDeactivatedObservable() { var viewModelActivator = new ViewModelActivator(); viewModelActivator.Deactivated.ToObservableChangeSet(ImmediateScheduler.Instance).Bind(out var deactivated).Subscribe(); @@ -34,8 +43,11 @@ public void DeactivatingIgnoringRefCountTicksDeactivatedObservable() Assert.Equal(1, deactivated.Count); } + /// + /// Tests the deactivating count doesnt tick deactivated observable. + /// [Fact] - public void DeactivatingCountDoesntTickDeactivatedObservable() + public void TestDeactivatingCountDoesntTickDeactivatedObservable() { var viewModelActivator = new ViewModelActivator(); viewModelActivator.Deactivated.ToObservableChangeSet(ImmediateScheduler.Instance).Bind(out var deactivated).Subscribe(); @@ -45,8 +57,11 @@ public void DeactivatingCountDoesntTickDeactivatedObservable() Assert.Equal(0, deactivated.Count); } + /// + /// Tests the deactivating following activating ticks deactivated observable. + /// [Fact] - public void DeactivatingFollowingActivatingTicksDeactivatedObservable() + public void TestDeactivatingFollowingActivatingTicksDeactivatedObservable() { var viewModelActivator = new ViewModelActivator(); viewModelActivator.Deactivated.ToObservableChangeSet(ImmediateScheduler.Instance).Bind(out var deactivated).Subscribe(); @@ -57,8 +72,11 @@ public void DeactivatingFollowingActivatingTicksDeactivatedObservable() Assert.Equal(1, deactivated.Count); } + /// + /// Tests the disposing after activation deactivates view model. + /// [Fact] - public void DisposingAfterActivationDeactivatesViewModel() + public void TestDisposingAfterActivationDeactivatesViewModel() { var viewModelActivator = new ViewModelActivator(); viewModelActivator.Activated.ToObservableChangeSet(ImmediateScheduler.Instance).Bind(out var activated).Subscribe(); diff --git a/src/ReactiveUI.Tests/AutoPersist/AutoPersistCollectionTests.cs b/src/ReactiveUI.Tests/AutoPersist/AutoPersistCollectionTests.cs index 540e3a858b..6c82cb11c1 100644 --- a/src/ReactiveUI.Tests/AutoPersist/AutoPersistCollectionTests.cs +++ b/src/ReactiveUI.Tests/AutoPersist/AutoPersistCollectionTests.cs @@ -14,8 +14,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests to make sure that the auto persist collection works. + /// public class AutoPersistCollectionTests { + /// + /// Test the automatic persist collection smoke test. + /// [Fact] public void AutoPersistCollectionSmokeTest() => new TestScheduler().With(scheduler => @@ -75,6 +81,9 @@ public void AutoPersistCollectionSmokeTest() => Assert.Equal(3, timesSaved); }); + /// + /// Test the automatic persist collection disconnects on dispose. + /// [Fact] public void AutoPersistCollectionDisconnectsOnDispose() => new TestScheduler().With(scheduler => diff --git a/src/ReactiveUI.Tests/AutoPersist/AutoPersistHelperTest.cs b/src/ReactiveUI.Tests/AutoPersist/AutoPersistHelperTest.cs index b3f160a543..f8ae42f2db 100644 --- a/src/ReactiveUI.Tests/AutoPersist/AutoPersistHelperTest.cs +++ b/src/ReactiveUI.Tests/AutoPersist/AutoPersistHelperTest.cs @@ -14,8 +14,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests the AutoPersistHelper. + /// public class AutoPersistHelperTest { + /// + /// Test the automatic persist doesnt work on non data contract classes. + /// [Fact] public void AutoPersistDoesntWorkOnNonDataContractClasses() { @@ -34,6 +40,9 @@ public void AutoPersistDoesntWorkOnNonDataContractClasses() Assert.False(shouldDie); } + /// + /// Test the automatic persist helper shouldnt trigger on non persistable properties. + /// [Fact] public void AutoPersistHelperShouldntTriggerOnNonPersistableProperties() => new TestScheduler().With(scheduler => @@ -61,6 +70,9 @@ public void AutoPersistHelperShouldntTriggerOnNonPersistableProperties() => Assert.Equal(0, timesSaved); }); + /// + /// Tests the automatic persist helper saves on interval. + /// [Fact] public void AutoPersistHelperSavesOnInterval() => new TestScheduler().With(scheduler => @@ -100,6 +112,9 @@ public void AutoPersistHelperSavesOnInterval() => Assert.Equal(3, timesSaved); }); + /// + /// Tests the automatic persist helper disconnects. + /// [Fact] public void AutoPersistHelperDisconnects() => new TestScheduler().With(scheduler => diff --git a/src/ReactiveUI.Tests/AwaiterTest.cs b/src/ReactiveUI.Tests/AwaiterTest.cs index 7a839ead58..dc3b9a3bcf 100644 --- a/src/ReactiveUI.Tests/AwaiterTest.cs +++ b/src/ReactiveUI.Tests/AwaiterTest.cs @@ -14,8 +14,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests the awaiters. + /// public class AwaiterTest { + /// + /// A smoke test for Awaiters. + /// [Fact] public void AwaiterSmokeTest() { diff --git a/src/ReactiveUI.Tests/BindingTypeConvertersTest.cs b/src/ReactiveUI.Tests/BindingTypeConvertersTest.cs index 97efbe1ab1..55d9e528cc 100644 --- a/src/ReactiveUI.Tests/BindingTypeConvertersTest.cs +++ b/src/ReactiveUI.Tests/BindingTypeConvertersTest.cs @@ -9,8 +9,14 @@ namespace ReactiveUI.Tests { using System; + /// + /// Tests for binding type converters. + /// public class BindingTypeConvertersTest { + /// + /// Tests that equality type converter do reference cast should convert null nullable values. + /// [Fact] public void EqualityTypeConverterDoReferenceCastShouldConvertNullNullableValues() { @@ -20,6 +26,9 @@ public void EqualityTypeConverterDoReferenceCastShouldConvertNullNullableValues( Assert.Equal(expected, result); } + /// + /// Tests that equality type converter do reference cast should convert nullable values. + /// [Fact] public void EqualityTypeConverterDoReferenceCastShouldConvertNullableValues() { @@ -29,6 +38,9 @@ public void EqualityTypeConverterDoReferenceCastShouldConvertNullableValues() Assert.Equal(expected, result); } + /// + /// Tests that equality type converter do reference cast should throw when converting from null nullable to value. + /// [Fact] public void EqualityTypeConverterDoReferenceCastShouldThrowWhenConvertingFromNullNullableToValueType() { @@ -36,6 +48,9 @@ public void EqualityTypeConverterDoReferenceCastShouldThrowWhenConvertingFromNul Assert.Throws(() => EqualityTypeConverter.DoReferenceCast(nullDouble, typeof(double))); } + /// + /// Tests that equality type converter do reference cast nullable to value. + /// [Fact] public void EqualityTypeConverterDoReferenceCastNullableToValueType() { @@ -45,6 +60,9 @@ public void EqualityTypeConverterDoReferenceCastNullableToValueType() Assert.Equal(expected, result); } + /// + /// Tests that equality type converter do reference cast should convert value types. + /// [Fact] public void EqualityTypeConverterDoReferenceCastShouldConvertValueTypes() { diff --git a/src/ReactiveUI.Tests/Commands/CombinedReactiveCommandTest.cs b/src/ReactiveUI.Tests/Commands/CombinedReactiveCommandTest.cs index 37d3b0d2a6..3150187070 100644 --- a/src/ReactiveUI.Tests/Commands/CombinedReactiveCommandTest.cs +++ b/src/ReactiveUI.Tests/Commands/CombinedReactiveCommandTest.cs @@ -15,8 +15,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the ReactiveCommand Combined functionality. + /// public class CombinedReactiveCommandTest { + /// + /// Tests that determines whether this instance [can execute is false if any child cannot execute]. + /// [Fact] public void CanExecuteIsFalseIfAnyChildCannotExecute() { @@ -30,6 +36,9 @@ public void CanExecuteIsFalseIfAnyChildCannotExecute() Assert.False(canExecute[0]); } + /// + /// Test that determines whether this instance [can execute is false if parent can execute is false]. + /// [Fact] public void CanExecuteIsFalseIfParentCanExecuteIsFalse() { @@ -43,6 +52,9 @@ public void CanExecuteIsFalseIfParentCanExecuteIsFalse() Assert.False(canExecute[0]); } + /// + /// Test that determines whether this instance [can execute ticks failures in child can execute through thrown exceptions]. + /// [Fact] public void CanExecuteTicksFailuresInChildCanExecuteThroughThrownExceptions() { @@ -59,6 +71,9 @@ public void CanExecuteTicksFailuresInChildCanExecuteThroughThrownExceptions() Assert.Equal("oops", thrownExceptions[0].Message); } + /// + /// Test that determines whether this instance [can execute ticks failures through thrown exceptions]. + /// [Fact] public void CanExecuteTicksFailuresThroughThrownExceptions() { @@ -75,6 +90,9 @@ public void CanExecuteTicksFailuresThroughThrownExceptions() Assert.Equal("oops", thrownExceptions[0].Message); } + /// + /// A test that checks that all the exceptions that were delivered through the output scheduler. + /// [Fact] public void ExceptionsAreDeliveredOnOutputScheduler() => new TestScheduler().With( @@ -92,6 +110,9 @@ public void ExceptionsAreDeliveredOnOutputScheduler() => Assert.IsType(exception); }); + /// + /// A test that executes the executes all child commands. + /// [Fact] public void ExecuteExecutesAllChildCommands() { @@ -129,6 +150,9 @@ public void ExecuteExecutesAllChildCommands() Assert.False(child3IsExecuting[2]); } + /// + /// Test that executes the ticks errors in any child command through thrown exceptions. + /// [Fact] public void ExecuteTicksErrorsInAnyChildCommandThroughThrownExceptions() { @@ -144,6 +168,9 @@ public void ExecuteTicksErrorsInAnyChildCommandThroughThrownExceptions() Assert.Equal("oops", thrownExceptions[0].Message); } + /// + /// Test that executes the ticks through the results. + /// [Fact] public void ExecuteTicksThroughTheResults() { @@ -162,6 +189,9 @@ public void ExecuteTicksThroughTheResults() Assert.Equal(2, results[0][1]); } + /// + /// Test that checks that results is ticked through specified scheduler. + /// [Fact] public void ResultIsTickedThroughSpecifiedScheduler() => new TestScheduler().With( diff --git a/src/ReactiveUI.Tests/Commands/CreatesCommandBindingTests.cs b/src/ReactiveUI.Tests/Commands/CreatesCommandBindingTests.cs index 8ea649e045..5c868f4238 100644 --- a/src/ReactiveUI.Tests/Commands/CreatesCommandBindingTests.cs +++ b/src/ReactiveUI.Tests/Commands/CreatesCommandBindingTests.cs @@ -12,8 +12,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the CreateCommand binding. + /// public class CreatesCommandBindingTests { + /// + /// Test that makes sure events binder binds to explicit event. + /// [Fact] public void EventBinderBindsToExplicitEvent() { diff --git a/src/ReactiveUI.Tests/Commands/Mocks/FakeCommand.cs b/src/ReactiveUI.Tests/Commands/Mocks/FakeCommand.cs index 97da62636f..2ad4a6219d 100644 --- a/src/ReactiveUI.Tests/Commands/Mocks/FakeCommand.cs +++ b/src/ReactiveUI.Tests/Commands/Mocks/FakeCommand.cs @@ -8,28 +8,58 @@ namespace ReactiveUI.Tests { + /// + /// A fake command that can be executed as part of a test. + /// public class FakeCommand : ICommand { + /// + /// Initializes a new instance of the class. + /// public FakeCommand() { CanExecuteParameter = default; ExecuteParameter = default; } + /// + /// Occurs when changes occur that affect whether or not the command should execute. + /// public event EventHandler? CanExecuteChanged; + /// + /// Gets the can execute parameter. + /// public object? CanExecuteParameter { get; private set; } + /// + /// Gets the execute parameter. + /// public object? ExecuteParameter { get; private set; } + /// + /// Defines the method that determines whether the command can execute in its current state. + /// + /// Data used by the command. If the command does not require data to be passed, this object can be set to . + /// + /// if this command can be executed; otherwise, . + /// public bool CanExecute(object? parameter) { CanExecuteParameter = parameter; return true; } + /// + /// Defines the method to be called when the command is invoked. + /// + /// Data used by the command. If the command does not require data to be passed, this object can be set to . public void Execute(object? parameter) => ExecuteParameter = parameter; + /// + /// Notifies the can execute changed. + /// + /// The instance containing the event data. protected virtual void NotifyCanExecuteChanged(EventArgs e) => CanExecuteChanged?.Invoke(this, e); } } diff --git a/src/ReactiveUI.Tests/Commands/Mocks/ICommandHolder.cs b/src/ReactiveUI.Tests/Commands/Mocks/ICommandHolder.cs index d07b8f89a7..083ae5e6bb 100644 --- a/src/ReactiveUI.Tests/Commands/Mocks/ICommandHolder.cs +++ b/src/ReactiveUI.Tests/Commands/Mocks/ICommandHolder.cs @@ -7,10 +7,16 @@ namespace ReactiveUI.Tests { + /// + /// A ReactiveObject which hosts a command. + /// public class ICommandHolder : ReactiveObject { private ICommand? _theCommand; + /// + /// Gets or sets the command. + /// public ICommand? TheCommand { get => _theCommand; diff --git a/src/ReactiveUI.Tests/Commands/Mocks/ReactiveCommandHolder.cs b/src/ReactiveUI.Tests/Commands/Mocks/ReactiveCommandHolder.cs index 93df9fbcc6..6956330130 100644 --- a/src/ReactiveUI.Tests/Commands/Mocks/ReactiveCommandHolder.cs +++ b/src/ReactiveUI.Tests/Commands/Mocks/ReactiveCommandHolder.cs @@ -7,10 +7,17 @@ namespace ReactiveUI.Tests { + /// + /// A ReactiveObject which hosts a ReactiveCommand. + /// + /// public class ReactiveCommandHolder : ReactiveObject { private ReactiveCommand? _theCommand; + /// + /// Gets or sets the command. + /// public ReactiveCommand? TheCommand { get => _theCommand; diff --git a/src/ReactiveUI.Tests/Commands/ReactiveCommandTest.cs b/src/ReactiveUI.Tests/Commands/ReactiveCommandTest.cs index 5c0dd6cefc..e2e5782ff0 100644 --- a/src/ReactiveUI.Tests/Commands/ReactiveCommandTest.cs +++ b/src/ReactiveUI.Tests/Commands/ReactiveCommandTest.cs @@ -23,8 +23,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the ReactiveCommand class. + /// public class ReactiveCommandTest { + /// + /// A test that determines whether this instance [can execute changed is available via ICommand]. + /// [Fact] public void CanExecuteChangedIsAvailableViaICommand() { @@ -41,6 +47,9 @@ public void CanExecuteChangedIsAvailableViaICommand() Assert.False(canExecuteChanged[1]); } + /// + /// A test that determines whether this instance [can execute is available via ICommand]. + /// [Fact] public void CanExecuteIsAvailableViaICommand() { @@ -56,6 +65,9 @@ public void CanExecuteIsAvailableViaICommand() Assert.False(fixture.CanExecute(null)); } + /// + /// Test that determines whether this instance [can execute is behavioral]. + /// [Fact] public void CanExecuteIsBehavioral() { @@ -66,6 +78,9 @@ public void CanExecuteIsBehavioral() Assert.True(canExecute[0]); } + /// + /// Test that determines whether this instance [can execute is false if already executing]. + /// [Fact] public void CanExecuteIsFalseIfAlreadyExecuting() => new TestScheduler().With( @@ -87,6 +102,9 @@ public void CanExecuteIsFalseIfAlreadyExecuting() => Assert.True(canExecute[2]); }); + /// + /// Test that determines whether this instance [can execute is false if caller dictates as such]. + /// [Fact] public void CanExecuteIsFalseIfCallerDictatesAsSuch() { @@ -103,6 +121,9 @@ public void CanExecuteIsFalseIfCallerDictatesAsSuch() Assert.False(canExecute[2]); } + /// + /// Test that determines whether this instance [can execute is unsubscribed after command disposal]. + /// [Fact] public void CanExecuteIsUnsubscribedAfterCommandDisposal() { @@ -116,6 +137,9 @@ public void CanExecuteIsUnsubscribedAfterCommandDisposal() Assert.False(canExecuteSubject.HasObservers); } + /// + /// Test that determines whether this instance [can execute only ticks distinct values]. + /// [Fact] public void CanExecuteOnlyTicksDistinctValues() { @@ -135,6 +159,9 @@ public void CanExecuteOnlyTicksDistinctValues() Assert.True(canExecute[1]); } + /// + /// Test that determines whether this instance [can execute ticks failures through thrown exceptions]. + /// [Fact] public void CanExecuteTicksFailuresThroughThrownExceptions() { @@ -148,6 +175,9 @@ public void CanExecuteTicksFailuresThroughThrownExceptions() Assert.Equal("oops", thrownExceptions[0].Message); } + /// + /// Creates the task facilitates TPL integration. + /// [Fact] public void CreateTaskFacilitatesTPLIntegration() { @@ -160,6 +190,9 @@ public void CreateTaskFacilitatesTPLIntegration() Assert.Equal(13, results[0]); } + /// + /// Creates the task facilitates TPL integration with parameter. + /// [Fact] public void CreateTaskFacilitatesTPLIntegrationWithParameter() { @@ -174,6 +207,9 @@ public void CreateTaskFacilitatesTPLIntegrationWithParameter() Assert.Equal(42, results[1]); } + /// + /// Creates the throws if execution parameter is null. + /// [Fact] public void CreateThrowsIfExecutionParameterIsNull() { @@ -191,6 +227,9 @@ public void CreateThrowsIfExecutionParameterIsNull() #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. } + /// + /// Exceptions the are delivered on output scheduler. + /// [Fact] public void ExceptionsAreDeliveredOnOutputScheduler() => new TestScheduler().With( @@ -206,6 +245,9 @@ public void ExceptionsAreDeliveredOnOutputScheduler() => Assert.IsType(exception); }); + /// + /// Executes the can be cancelled. + /// [Fact] public void ExecuteCanBeCancelled() => new TestScheduler().With( @@ -228,6 +270,9 @@ public void ExecuteCanBeCancelled() => Assert.False(fixture.IsExecuting.FirstAsync().Wait()); }); + /// + /// Executes the can tick through multiple results. + /// [Fact] public void ExecuteCanTickThroughMultipleResults() { @@ -242,6 +287,9 @@ public void ExecuteCanTickThroughMultipleResults() Assert.Equal(3, results[2]); } + /// + /// Executes the facilitates any number of in flight executions. + /// [Fact] public void ExecuteFacilitatesAnyNumberOfInFlightExecutions() => new TestScheduler().With( @@ -276,6 +324,9 @@ public void ExecuteFacilitatesAnyNumberOfInFlightExecutions() => Assert.False(fixture.IsExecuting.FirstAsync().Wait()); }); + /// + /// Executes the is available via ICommand. + /// [Fact] public void ExecuteIsAvailableViaICommand() { @@ -292,6 +343,9 @@ public void ExecuteIsAvailableViaICommand() Assert.True(executed); } + /// + /// Executes the passes through parameter. + /// [Fact] public void ExecutePassesThroughParameter() { @@ -314,6 +368,9 @@ public void ExecutePassesThroughParameter() Assert.Equal(348, parameters[2]); } + /// + /// Executes the reenables execution even after failure. + /// [Fact] public void ExecuteReenablesExecutionEvenAfterFailure() { @@ -332,6 +389,9 @@ public void ExecuteReenablesExecutionEvenAfterFailure() Assert.True(canExecute[2]); } + /// + /// Executes the result is delivered on specified scheduler. + /// [Fact] public void ExecuteResultIsDeliveredOnSpecifiedScheduler() => new TestScheduler().With( @@ -348,6 +408,9 @@ public void ExecuteResultIsDeliveredOnSpecifiedScheduler() => Assert.True(executed); }); + /// + /// Executes the ticks any exception. + /// [Fact] public void ExecuteTicksAnyException() { @@ -359,6 +422,9 @@ public void ExecuteTicksAnyException() Assert.IsType(exception); } + /// + /// Executes the ticks any lambda exception. + /// [Fact] public void ExecuteTicksAnyLambdaException() { @@ -370,6 +436,9 @@ public void ExecuteTicksAnyLambdaException() Assert.IsType(exception); } + /// + /// Executes the ticks errors through thrown exceptions. + /// [Fact] public void ExecuteTicksErrorsThroughThrownExceptions() { @@ -382,6 +451,9 @@ public void ExecuteTicksErrorsThroughThrownExceptions() Assert.Equal("oops", thrownExceptions[0].Message); } + /// + /// Executes the ticks lambda errors through thrown exceptions. + /// [Fact] public void ExecuteTicksLambdaErrorsThroughThrownExceptions() { @@ -395,6 +467,9 @@ public void ExecuteTicksLambdaErrorsThroughThrownExceptions() Assert.True(fixture.CanExecute.FirstAsync().Wait()); } + /// + /// Executes the ticks through the result. + /// [Fact] public void ExecuteTicksThroughTheResult() { @@ -415,6 +490,9 @@ public void ExecuteTicksThroughTheResult() Assert.Equal(30, results[2]); } + /// + /// Executes via ICommand throws if parameter type is incorrect. + /// [Fact] public void ExecuteViaICommandThrowsIfParameterTypeIsIncorrect() { @@ -427,6 +505,9 @@ public void ExecuteViaICommandThrowsIfParameterTypeIsIncorrect() Assert.Equal("Command requires parameters of type System.String, but received parameter of type System.Int32.", ex.Message); } + /// + /// Executes via ICommand works with nullable types. + /// [Fact] public void ExecuteViaICommandWorksWithNullableTypes() { @@ -440,6 +521,9 @@ public void ExecuteViaICommandWorksWithNullableTypes() Assert.Null(value); } + /// + /// Test that invokes the command against ICommand in target invokes the command. + /// [Fact] public void InvokeCommandAgainstICommandInTargetInvokesTheCommand() { @@ -456,6 +540,9 @@ public void InvokeCommandAgainstICommandInTargetInvokesTheCommand() Assert.Equal(2, executionCount); } + /// + /// Test that invokes the command against ICommand in target passes the specified value to can execute and execute. + /// [Fact] public void InvokeCommandAgainstICommandInTargetPassesTheSpecifiedValueToCanExecuteAndExecute() { @@ -470,6 +557,9 @@ public void InvokeCommandAgainstICommandInTargetPassesTheSpecifiedValueToCanExec Assert.Equal(42, command.ExecuteParameter); } + /// + /// Test that invokes the command against i command in target respects can execute. + /// [Fact] public void InvokeCommandAgainstICommandInTargetRespectsCanExecute() { @@ -488,6 +578,9 @@ public void InvokeCommandAgainstICommandInTargetRespectsCanExecute() Assert.True(executed); } + /// + /// Test that invokes the command against ICommand in target respects can execute window. + /// [Fact] public void InvokeCommandAgainstICommandInTargetRespectsCanExecuteWindow() { @@ -507,6 +600,9 @@ public void InvokeCommandAgainstICommandInTargetRespectsCanExecuteWindow() Assert.False(executed); } + /// + /// Test that invokes the command against ICommand in target swallows exceptions. + /// [Fact] public void InvokeCommandAgainstICommandInTargetSwallowsExceptions() { @@ -530,6 +626,9 @@ public void InvokeCommandAgainstICommandInTargetSwallowsExceptions() Assert.Equal(2, count); } + /// + /// Test that invokes the command against ICommand invokes the command. + /// [Fact] public void InvokeCommandAgainstICommandInvokesTheCommand() { @@ -545,6 +644,9 @@ public void InvokeCommandAgainstICommandInvokesTheCommand() Assert.Equal(2, executionCount); } + /// + /// Test that invokes the command against ICommand passes the specified value to can execute and execute. + /// [Fact] public void InvokeCommandAgainstICommandPassesTheSpecifiedValueToCanExecuteAndExecute() { @@ -557,6 +659,9 @@ public void InvokeCommandAgainstICommandPassesTheSpecifiedValueToCanExecuteAndEx Assert.Equal(42, fixture.ExecuteParameter); } + /// + /// Test that invokes the command against ICommand respects can execute. + /// [Fact] public void InvokeCommandAgainstICommandRespectsCanExecute() { @@ -574,6 +679,9 @@ public void InvokeCommandAgainstICommandRespectsCanExecute() Assert.True(executed); } + /// + /// Test that invokes the command against ICommand respects can execute window. + /// [Fact] public void InvokeCommandAgainstICommandRespectsCanExecuteWindow() { @@ -592,6 +700,9 @@ public void InvokeCommandAgainstICommandRespectsCanExecuteWindow() Assert.False(executed); } + /// + /// Test that invokes the command against ICommand swallows exceptions. + /// [Fact] public void InvokeCommandAgainstICommandSwallowsExceptions() { @@ -613,6 +724,9 @@ public void InvokeCommandAgainstICommandSwallowsExceptions() Assert.Equal(2, count); } + /// + /// Test that invokes the command against reactive command in target invokes the command. + /// [Fact] public void InvokeCommandAgainstReactiveCommandInTargetInvokesTheCommand() { @@ -629,6 +743,9 @@ public void InvokeCommandAgainstReactiveCommandInTargetInvokesTheCommand() Assert.Equal(2, executionCount); } + /// + /// Test that invokes the command against reactive command in target passes the specified value to execute. + /// [Fact] public void InvokeCommandAgainstReactiveCommandInTargetPassesTheSpecifiedValueToExecute() { @@ -642,6 +759,9 @@ public void InvokeCommandAgainstReactiveCommandInTargetPassesTheSpecifiedValueTo Assert.Equal(42, executeReceived); } + /// + /// Test that invokes the command against reactive command in target respects can execute. + /// [Fact] public void InvokeCommandAgainstReactiveCommandInTargetRespectsCanExecute() { @@ -660,6 +780,9 @@ public void InvokeCommandAgainstReactiveCommandInTargetRespectsCanExecute() Assert.True(executed); } + /// + /// Test that invokes the command against reactive command in target respects can execute window. + /// [Fact] public void InvokeCommandAgainstReactiveCommandInTargetRespectsCanExecuteWindow() { @@ -679,6 +802,9 @@ public void InvokeCommandAgainstReactiveCommandInTargetRespectsCanExecuteWindow( Assert.False(executed); } + /// + /// Test that invokes the command against reactive command in target swallows exceptions. + /// [Fact] public void InvokeCommandAgainstReactiveCommandInTargetSwallowsExceptions() { @@ -703,6 +829,9 @@ public void InvokeCommandAgainstReactiveCommandInTargetSwallowsExceptions() Assert.Equal(2, count); } + /// + /// Test that invokes the command against reactive command invokes the command. + /// [Fact] public void InvokeCommandAgainstReactiveCommandInvokesTheCommand() { @@ -718,6 +847,9 @@ public void InvokeCommandAgainstReactiveCommandInvokesTheCommand() Assert.Equal(2, executionCount); } + /// + /// Test that invokes the command against reactive command passes the specified value to execute. + /// [Fact] public void InvokeCommandAgainstReactiveCommandPassesTheSpecifiedValueToExecute() { @@ -730,6 +862,9 @@ public void InvokeCommandAgainstReactiveCommandPassesTheSpecifiedValueToExecute( Assert.Equal(42, executeReceived); } + /// + /// Test that invokes the command against reactive command respects can execute. + /// [Fact] public void InvokeCommandAgainstReactiveCommandRespectsCanExecute() { @@ -747,6 +882,9 @@ public void InvokeCommandAgainstReactiveCommandRespectsCanExecute() Assert.True(executed); } + /// + /// Test that invokes the command against reactive command respects can execute window. + /// [Fact] public void InvokeCommandAgainstReactiveCommandRespectsCanExecuteWindow() { @@ -765,6 +903,9 @@ public void InvokeCommandAgainstReactiveCommandRespectsCanExecuteWindow() Assert.False(executed); } + /// + /// Test that invokes the command against reactive command swallows exceptions. + /// [Fact] public void InvokeCommandAgainstReactiveCommandSwallowsExceptions() { @@ -786,6 +927,9 @@ public void InvokeCommandAgainstReactiveCommandSwallowsExceptions() Assert.Equal(2, count); } + /// + /// Test that invokes the command works even if the source is cold. + /// [Fact] public void InvokeCommandWorksEvenIfTheSourceIsCold() { @@ -797,6 +941,9 @@ public void InvokeCommandWorksEvenIfTheSourceIsCold() Assert.Equal(1, executionCount); } + /// + /// Test that determines whether [is executing is behavioral]. + /// [Fact] public void IsExecutingIsBehavioral() { @@ -807,6 +954,9 @@ public void IsExecutingIsBehavioral() Assert.False(isExecuting[0]); } + /// + /// Test that determines whether [is executing remains true as long as execution pipeline has not completed]. + /// [Fact] public void IsExecutingRemainsTrueAsLongAsExecutionPipelineHasNotCompleted() { @@ -827,6 +977,9 @@ public void IsExecutingRemainsTrueAsLongAsExecutionPipelineHasNotCompleted() Assert.False(fixture.IsExecuting.FirstAsync().Wait()); } + /// + /// Test that determines whether [is executing ticks as executions progress]. + /// [Fact] public void IsExecutingTicksAsExecutionsProgress() => new TestScheduler().With( @@ -849,6 +1002,9 @@ public void IsExecutingTicksAsExecutionsProgress() => Assert.False(isExecuting[2]); }); + /// + /// Results the is ticked through specified scheduler. + /// [Fact] public void ResultIsTickedThroughSpecifiedScheduler() => new TestScheduler().With( @@ -864,6 +1020,9 @@ public void ResultIsTickedThroughSpecifiedScheduler() => Assert.Equal(1, results.Count); }); + /// + /// Synchronouses the command execute lazily. + /// [Fact] public void SynchronousCommandExecuteLazily() { @@ -904,6 +1063,9 @@ public void SynchronousCommandExecuteLazily() Assert.Equal(4, executionCount); } + /// + /// Synchronouses the commands fail correctly. + /// [Fact] public void SynchronousCommandsFailCorrectly() { diff --git a/src/ReactiveUI.Tests/Comparers/OrderedComparerTests.cs b/src/ReactiveUI.Tests/Comparers/OrderedComparerTests.cs index 0fbda30e16..95b8f7a994 100644 --- a/src/ReactiveUI.Tests/Comparers/OrderedComparerTests.cs +++ b/src/ReactiveUI.Tests/Comparers/OrderedComparerTests.cs @@ -12,8 +12,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the ordered comparer. + /// public class OrderedComparerTests { + /// + /// A general smoke test. + /// [Fact] public void SmokeTest() { @@ -45,6 +51,9 @@ public void SmokeTest() Assert.True(employees.SequenceEqual(new[] { adam, carol, xavier, bob, alice })); } + /// + /// A test which determines if customer comparers work. + /// [Fact] public void CustomComparerTest() { @@ -63,6 +72,9 @@ public void CustomComparerTest() Assert.True(items.SequenceEqual(new[] { "AAA", "AAA", "abb", "aaaa" }, StringComparer.OrdinalIgnoreCase)); } + /// + /// Test for checking that chaining the onto regular IComparable works. + /// [Fact] public void ChainOntoRegularIComparables() { @@ -76,6 +88,9 @@ public void ChainOntoRegularIComparables() Assert.True(items.SequenceEqual(new[] { "aaa", "AAA", "aaaa", "abb" }, StringComparer.Ordinal)); } + /// + /// Test that checks it works with anonymous types. + /// [Fact] public void WorksWithAnonymousTypes() { diff --git a/src/ReactiveUI.Tests/InteractionBinding/InteractionBinderImplementationTests.cs b/src/ReactiveUI.Tests/InteractionBinding/InteractionBinderImplementationTests.cs index 379974427a..26a6fe9153 100644 --- a/src/ReactiveUI.Tests/InteractionBinding/InteractionBinderImplementationTests.cs +++ b/src/ReactiveUI.Tests/InteractionBinding/InteractionBinderImplementationTests.cs @@ -15,10 +15,17 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the Interaction bindings. + /// public class InteractionBinderImplementationTests { + /// + /// Tests that make sure that the we receive output from task handler. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldReceiveOutputFromTaskHandler() + public async Task ReceiveOutputFromTaskHandler() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -37,8 +44,12 @@ public async Task ShouldReceiveOutputFromTaskHandler() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Test that we receive output from the observable handler. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldReceiveOutputFromObservableHandler() + public async Task ReceiveOutputFromObservableHandler() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -57,8 +68,12 @@ public async Task ShouldReceiveOutputFromObservableHandler() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Test that checks that the receive output from task handler when view model was initially null. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldReceiveOutputFromTaskHandlerWhenViewModelWasInitiallyNull() + public async Task ReceiveOutputFromTaskHandlerWhenViewModelWasInitiallyNull() { InteractionBindViewModel? vm = null; var view = new InteractionBindView { ViewModel = vm }; @@ -79,8 +94,12 @@ public async Task ShouldReceiveOutputFromTaskHandlerWhenViewModelWasInitiallyNul isDeletionConfirmed.Should().BeTrue(); } + /// + /// Test that checks that the receive output from observable handler when view model was initially null. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldReceiveOutputFromObservableHandlerWhenViewModelWasInitiallyNull() + public async Task ReceiveOutputFromObservableHandlerWhenViewModelWasInitiallyNull() { InteractionBindViewModel? vm = null; var view = new InteractionBindView { ViewModel = vm }; @@ -101,8 +120,11 @@ public async Task ShouldReceiveOutputFromObservableHandlerWhenViewModelWasInitia isDeletionConfirmed.Should().BeTrue(); } + /// + /// Tests to make sure that it unregisters the task handler when view model is set to null. + /// [Fact] - public void ShouldUnregisterTaskHandlerWhenViewModelIsSetToNull() + public void UnregisterTaskHandlerWhenViewModelIsSetToNull() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -121,8 +143,11 @@ public void ShouldUnregisterTaskHandlerWhenViewModelIsSetToNull() _ = Assert.ThrowsAsync>(() => vm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it unregisters the observable handler when view model is set to null. + /// [Fact] - public void ShouldUnregisterObservableHandlerWhenViewModelIsSetToNull() + public void UnregisterObservableHandlerWhenViewModelIsSetToNull() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -141,8 +166,11 @@ public void ShouldUnregisterObservableHandlerWhenViewModelIsSetToNull() _ = Assert.ThrowsAsync>(() => vm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it unregisters the task handler from overwritten view model. + /// [Fact] - public void ShouldUnregisterTaskHandlerFromOverwrittenViewModel() + public void UnregisterTaskHandlerFromOverwrittenViewModel() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -161,8 +189,11 @@ public void ShouldUnregisterTaskHandlerFromOverwrittenViewModel() _ = Assert.ThrowsAsync>(() => vm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it unregisters the observable handler from overwritten view model. + /// [Fact] - public void ShouldUnregisterObservableHandlerFromOverwrittenViewModel() + public void UnregisterObservableHandlerFromOverwrittenViewModel() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -181,8 +212,12 @@ public void ShouldUnregisterObservableHandlerFromOverwrittenViewModel() _ = Assert.ThrowsAsync>(() => vm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it registers the task handler to newly assigned view model. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldRegisterTaskHandlerToNewlyAssignedViewModel() + public async Task RegisterTaskHandlerToNewlyAssignedViewModel() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -203,8 +238,12 @@ public async Task ShouldRegisterTaskHandlerToNewlyAssignedViewModel() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Tests to make sure that it registers the observable handler to newly assigned view model. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldRegisterObservableHandlerToNewlyAssignedViewModel() + public async Task RegisterObservableHandlerToNewlyAssignedViewModel() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -225,6 +264,10 @@ public async Task ShouldRegisterObservableHandlerToNewlyAssignedViewModel() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Tests to confirm nested interaction should receive output from task handler. + /// + /// A task to monitor the progress. [Fact] public async Task NestedInteractionShouldReceiveOutputFromTaskHandler() { @@ -245,6 +288,10 @@ public async Task NestedInteractionShouldReceiveOutputFromTaskHandler() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Tests to confirm nested interaction should receive output from observable handler. + /// + /// A task to monitor the progress. [Fact] public async Task NestedInteractionShouldReceiveOutputFromObservableHandler() { @@ -265,8 +312,11 @@ public async Task NestedInteractionShouldReceiveOutputFromObservableHandler() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Test to confirm that unregistering the task handler from overwritten nested view model. + /// [Fact] - public void ShouldUnregisterTaskHandlerFromOverwrittenNestedViewModel() + public void UnregisterTaskHandlerFromOverwrittenNestedViewModel() { var firstInteractionVm = new InteractionBindViewModel(); var vm = new InteractionAncestorViewModel(); @@ -286,8 +336,11 @@ public void ShouldUnregisterTaskHandlerFromOverwrittenNestedViewModel() _ = Assert.ThrowsAsync>(() => firstInteractionVm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it unregisters the observable handler from overwritten nested view model. + /// [Fact] - public void ShouldUnregisterObservableHandlerFromOverwrittenNestedViewModel() + public void UnregisterObservableHandlerFromOverwrittenNestedViewModel() { var firstInteractionVm = new InteractionBindViewModel(); var vm = new InteractionAncestorViewModel(); @@ -307,8 +360,12 @@ public void ShouldUnregisterObservableHandlerFromOverwrittenNestedViewModel() _ = Assert.ThrowsAsync>(() => firstInteractionVm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it registers the task handler to newly assigned nested view model. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldRegisterTaskHandlerToNewlyAssignedNestedViewModel() + public async Task RegisterTaskHandlerToNewlyAssignedNestedViewModel() { var vm = new InteractionAncestorViewModel() { @@ -332,8 +389,12 @@ public async Task ShouldRegisterTaskHandlerToNewlyAssignedNestedViewModel() isDeletionConfirmed.Should().BeTrue(); } + /// + /// Tests to make sure that it registers the observable handler to newly assigned nested view model. + /// + /// A task to monitor the progress. [Fact] - public async Task ShouldRegisterObservableHandlerToNewlyAssignedNestedViewModel() + public async Task RegisterObservableHandlerToNewlyAssignedNestedViewModel() { var vm = new InteractionAncestorViewModel() { @@ -357,8 +418,11 @@ public async Task ShouldRegisterObservableHandlerToNewlyAssignedNestedViewModel( isDeletionConfirmed.Should().BeTrue(); } + /// + /// Tests to make sure that it unregisters the task handler when binding is disposed. + /// [Fact] - public void ShouldUnregisterTaskHandlerWhenBindingIsDisposed() + public void UnregisterTaskHandlerWhenBindingIsDisposed() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -377,8 +441,11 @@ public void ShouldUnregisterTaskHandlerWhenBindingIsDisposed() _ = Assert.ThrowsAsync>(() => vm.Interaction1.Handle("123").ToTask()); } + /// + /// Tests to make sure that it unregisters the observable handler when binding is disposed. + /// [Fact] - public void ShouldUnregisterObservableHandlerWhenBindingIsDisposed() + public void UnregisterObservableHandlerWhenBindingIsDisposed() { var vm = new InteractionBindViewModel(); var view = new InteractionBindView { ViewModel = vm }; @@ -397,6 +464,9 @@ public void ShouldUnregisterObservableHandlerWhenBindingIsDisposed() _ = Assert.ThrowsAsync>(() => vm.Interaction1.Handle("123").ToTask()); } + /// + /// Test that confirms the view model should be garbage collected when overwritten. + /// [Fact] public void ViewModelShouldBeGarbageCollectedWhenOverwritten() { @@ -426,6 +496,9 @@ public void ViewModelShouldBeGarbageCollectedWhenOverwritten() Assert.False(weakRef.IsAlive); } + /// + /// Test that confirms nested view model should be garbage collected when overwritten. + /// [Fact] public void NestedViewModelShouldBeGarbageCollectedWhenOverwritten() { diff --git a/src/ReactiveUI.Tests/InteractionsTest.cs b/src/ReactiveUI.Tests/InteractionsTest.cs index da8a6f4088..b5f85b601b 100644 --- a/src/ReactiveUI.Tests/InteractionsTest.cs +++ b/src/ReactiveUI.Tests/InteractionsTest.cs @@ -15,8 +15,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests interactions. + /// public class InteractionsTest { + /// + /// Tests that registers null handler should cause exception. + /// [Fact] public void RegisterNullHandlerShouldCauseException() { @@ -27,6 +33,9 @@ public void RegisterNullHandlerShouldCauseException() Assert.Throws(() => interaction.RegisterHandler((Func, IObservable>)null!)); } + /// + /// Tests that unhandled interactions should cause exception. + /// [Fact] public void UnhandledInteractionsShouldCauseException() { @@ -42,6 +51,9 @@ public void UnhandledInteractionsShouldCauseException() Assert.Equal("bar", ex.Input); } + /// + /// Test that attempting to set interaction output more than once should cause exception. + /// [Fact] public void AttemptingToSetInteractionOutputMoreThanOnceShouldCauseException() { @@ -57,6 +69,9 @@ public void AttemptingToSetInteractionOutputMoreThanOnceShouldCauseException() Assert.Equal("Output has already been set.", ex.Message); } + /// + /// Test that attempting to get interaction output before it has been set should cause exception. + /// [Fact] public void AttemptingToGetInteractionOutputBeforeItHasBeenSetShouldCauseException() { @@ -71,6 +86,9 @@ public void AttemptingToGetInteractionOutputBeforeItHasBeenSetShouldCauseExcepti Assert.Equal("Output has not been set.", ex.Message); } + /// + /// Tests that Handled interactions should not cause exception. + /// [Fact] public void HandledInteractionsShouldNotCauseException() { @@ -80,6 +98,9 @@ public void HandledInteractionsShouldNotCauseException() interaction.Handle(Unit.Default).FirstAsync().Wait(); } + /// + /// Tests that Handlers are executed on handler scheduler. + /// [Fact] public void HandlersAreExecutedOnHandlerScheduler() => new TestScheduler().With(scheduler => @@ -100,6 +121,9 @@ public void HandlersAreExecutedOnHandlerScheduler() => } }); + /// + /// Test that Nested handlers are executed in reverse order of subscription. + /// [Fact] public void NestedHandlersAreExecutedInReverseOrderOfSubscription() { @@ -125,6 +149,9 @@ public void NestedHandlersAreExecutedInReverseOrderOfSubscription() } } + /// + /// Tests that handlers can opt not to handle the interaction. + /// [Fact] public void HandlersCanOptNotToHandleTheInteraction() { @@ -161,6 +188,9 @@ public void HandlersCanOptNotToHandleTheInteraction() } } + /// + /// Test that handlers can contain asynchronous code. + /// [Fact] public void HandlersCanContainAsynchronousCode() { @@ -200,6 +230,9 @@ public void HandlersCanContainAsynchronousCode() Assert.False(handler1AWasCalled); } + /// + /// Test that handlers can contain asynchronous code via tasks. + /// [Fact] public void HandlersCanContainAsynchronousCodeViaTasks() { @@ -217,6 +250,9 @@ public void HandlersCanContainAsynchronousCodeViaTasks() .Subscribe(r => result = r); } + /// + /// Tests that handlers returning observables can return any kind of observable. + /// [Fact] public void HandlersReturningObservablesCanReturnAnyKindOfObservable() { diff --git a/src/ReactiveUI.Tests/Locator/DefaultViewLocatorTests.cs b/src/ReactiveUI.Tests/Locator/DefaultViewLocatorTests.cs index 075082d293..7018c16568 100644 --- a/src/ReactiveUI.Tests/Locator/DefaultViewLocatorTests.cs +++ b/src/ReactiveUI.Tests/Locator/DefaultViewLocatorTests.cs @@ -12,8 +12,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the default view locators. + /// public class DefaultViewLocatorTests { + /// + /// Tests that the the default name of the view model is replaced with view when determining the service. + /// [Fact] public void ByDefaultViewModelIsReplacedWithViewWhenDeterminingTheServiceName() { @@ -33,6 +39,9 @@ public void ByDefaultViewModelIsReplacedWithViewWhenDeterminingTheServiceName() } } + /// + /// Tests that the runtime type of the view model is used to resolve the view. + /// [Fact] public void TheRuntimeTypeOfTheViewModelIsUsedToResolveTheView() { @@ -52,6 +61,9 @@ public void TheRuntimeTypeOfTheViewModelIsUsedToResolveTheView() } } + /// + /// Tests that the view model to view naming convention can be customized. + /// [Fact] [SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "Not in all platforms.")] public void ViewModelToViewNamingConventionCanBeCustomized() @@ -74,6 +86,9 @@ public void ViewModelToViewNamingConventionCanBeCustomized() } } + /// + /// Tests that makes sure that this instance [can resolve view from view model class using class registration]. + /// [Fact] public void CanResolveViewFromViewModelClassUsingClassRegistration() { @@ -93,6 +108,9 @@ public void CanResolveViewFromViewModelClassUsingClassRegistration() } } + /// + /// Tests that make sure this instance [can resolve view from view model class using interface registration]. + /// [Fact] public void CanResolveViewFromViewModelClassUsingInterfaceRegistration() { @@ -112,6 +130,9 @@ public void CanResolveViewFromViewModelClassUsingInterfaceRegistration() } } + /// + /// Test that makes sure that this instance [can resolve view from view model class using IView for registration]. + /// [Fact] public void CanResolveViewFromViewModelClassUsingIViewForRegistration() { @@ -131,6 +152,9 @@ public void CanResolveViewFromViewModelClassUsingIViewForRegistration() } } + /// + /// Tests that this instance [can resolve view from view model interface using class registration]. + /// [Fact] public void CanResolveViewFromViewModelInterfaceUsingClassRegistration() { @@ -150,6 +174,9 @@ public void CanResolveViewFromViewModelInterfaceUsingClassRegistration() } } + /// + /// Tests that this instance [can resolve view from view model interface using interface registration]. + /// [Fact] public void CanResolveViewFromViewModelInterfaceUsingInterfaceRegistration() { @@ -169,6 +196,9 @@ public void CanResolveViewFromViewModelInterfaceUsingInterfaceRegistration() } } + /// + /// Tests that this instance [can resolve view from view model interface using i view for registration]. + /// [Fact] public void CanResolveViewFromViewModelInterfaceUsingIViewForRegistration() { @@ -188,6 +218,9 @@ public void CanResolveViewFromViewModelInterfaceUsingIViewForRegistration() } } + /// + /// Tests that contracts is used when resolving view. + /// [Fact] public void ContractIsUsedWhenResolvingView() { @@ -214,6 +247,9 @@ public void ContractIsUsedWhenResolvingView() } } + /// + /// Tests that no errors are raised if a type cannot be found. + /// [Fact] public void NoErrorIsRaisedIfATypeCannotBeFound() { @@ -234,6 +270,9 @@ public void NoErrorIsRaisedIfATypeCannotBeFound() } } + /// + /// Tests that no errors are raised if a service cannot be found. + /// [Fact] public void NoErrorIsRaisedIfAServiceCannotBeFound() { @@ -252,6 +291,9 @@ public void NoErrorIsRaisedIfAServiceCannotBeFound() } } + /// + /// Tests that no errors are raised if the service does not implement IViewFor. + /// [Fact] public void NoErrorIsRaisedIfTheServiceDoesNotImplementIViewFor() { @@ -271,6 +313,9 @@ public void NoErrorIsRaisedIfTheServiceDoesNotImplementIViewFor() } } + /// + /// Tests that no errors are raised if the creation of the view fails. + /// [Fact] public void AnErrorIsRaisedIfTheCreationOfTheViewFails() { @@ -290,6 +335,9 @@ public void AnErrorIsRaisedIfTheCreationOfTheViewFails() } } + /// + /// Tests that with odd interface name doesnt throw exception. + /// [Fact] public void WithOddInterfaceNameDoesntThrowException() { @@ -308,6 +356,9 @@ public void WithOddInterfaceNameDoesntThrowException() } } + /// + /// Tests that whether this instance [can resolve view from view model with IRoutableViewModel]. + /// [Fact] public void CanResolveViewFromViewModelWithIRoutableViewModelType() { @@ -327,6 +378,9 @@ public void CanResolveViewFromViewModelWithIRoutableViewModelType() } } + /// + /// Tests that make sure this instance [can override name resolution function]. + /// [Fact] [SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "Not in all frameworks.")] public void CanOverrideNameResolutionFunc() diff --git a/src/ReactiveUI.Tests/Locator/Mocks/BarView.cs b/src/ReactiveUI.Tests/Locator/Mocks/BarView.cs index c27a47eefb..2185ea2a81 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/BarView.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/BarView.cs @@ -5,14 +5,25 @@ namespace ReactiveUI.Tests { + /// + /// A mock view. + /// public class BarView : IViewFor { + /// + /// Gets or sets the ViewModel corresponding to this specific View. This should be + /// a DependencyProperty if you're using XAML. + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (IBarViewModel?)value; } + /// + /// Gets or sets the ViewModel corresponding to this specific View. This should be + /// a DependencyProperty if you're using XAML. + /// public IBarViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/BarViewModel.cs b/src/ReactiveUI.Tests/Locator/Mocks/BarViewModel.cs index c4b2f86895..e84439febe 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/BarViewModel.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/BarViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view. + /// public class BarViewModel : ReactiveObject, IBarViewModel { } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/FooThatThrowsView.cs b/src/ReactiveUI.Tests/Locator/Mocks/FooThatThrowsView.cs index e3b2543f16..21bc3f5a1f 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/FooThatThrowsView.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/FooThatThrowsView.cs @@ -7,16 +7,25 @@ namespace ReactiveUI.Tests { + /// + /// A mock view which throws. + /// public class FooThatThrowsView : IFooView { + /// + /// Initializes a new instance of the class. + /// + /// This is a test failure. public FooThatThrowsView() => throw new InvalidOperationException("This is a test failure."); + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (IFooViewModel?)value; } + /// public IFooViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/FooView.cs b/src/ReactiveUI.Tests/Locator/Mocks/FooView.cs index b9736b3eb3..28ba16f38f 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/FooView.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/FooView.cs @@ -5,14 +5,19 @@ namespace ReactiveUI.Tests { + /// + /// A mock view. + /// public class FooView : IFooView { + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (IFooViewModel?)value; } + /// public IFooViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/FooViewModel.cs b/src/ReactiveUI.Tests/Locator/Mocks/FooViewModel.cs index 4a7e46753d..42dbd26d33 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/FooViewModel.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/FooViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class FooViewModel : ReactiveObject, IFooViewModel { } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/FooViewModelWithWeirdName.cs b/src/ReactiveUI.Tests/Locator/Mocks/FooViewModelWithWeirdName.cs index 6d65510abf..511ca1b263 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/FooViewModelWithWeirdName.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/FooViewModelWithWeirdName.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class FooViewModelWithWeirdName : ReactiveObject, IFooViewModel { } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/FooWithWeirdConvention.cs b/src/ReactiveUI.Tests/Locator/Mocks/FooWithWeirdConvention.cs index 7c5ec04c66..9bbc6532a8 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/FooWithWeirdConvention.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/FooWithWeirdConvention.cs @@ -5,14 +5,19 @@ namespace ReactiveUI.Tests { + /// + /// A mock view. + /// public class FooWithWeirdConvention : IFooView { + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (IFooViewModel?)value; } + /// public IFooViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/IBarViewModel.cs b/src/ReactiveUI.Tests/Locator/Mocks/IBarViewModel.cs index 5da8faf224..7e24dd6b88 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/IBarViewModel.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/IBarViewModel.cs @@ -7,6 +7,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock interface view model. + /// [SuppressMessage("Design", "CA1040: Avoid empty interfaces", Justification = "Deliberate empty interface.")] public interface IBarViewModel { diff --git a/src/ReactiveUI.Tests/Locator/Mocks/IFooView.cs b/src/ReactiveUI.Tests/Locator/Mocks/IFooView.cs index a473a177ad..21779ec98b 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/IFooView.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/IFooView.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A interface mock view. + /// public interface IFooView : IViewFor { } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/IFooViewModel.cs b/src/ReactiveUI.Tests/Locator/Mocks/IFooViewModel.cs index 7de641e18a..5372a0d00d 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/IFooViewModel.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/IFooViewModel.cs @@ -7,6 +7,9 @@ namespace ReactiveUI.Tests { + /// + /// A interface view model. + /// [SuppressMessage("Design", "CA1040: Avoid empty interfaces", Justification = "Deliberate empty interface.")] public interface IFooViewModel { diff --git a/src/ReactiveUI.Tests/Locator/Mocks/IRoutableFooViewModel.cs b/src/ReactiveUI.Tests/Locator/Mocks/IRoutableFooViewModel.cs index 4744f879d8..b704ddb426 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/IRoutableFooViewModel.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/IRoutableFooViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A interface routable view model. + /// public interface IRoutableFooViewModel : IRoutableViewModel { } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/IStrangeInterfaceNotFollowingConvention.cs b/src/ReactiveUI.Tests/Locator/Mocks/IStrangeInterfaceNotFollowingConvention.cs index 713317e060..9d4403273d 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/IStrangeInterfaceNotFollowingConvention.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/IStrangeInterfaceNotFollowingConvention.cs @@ -7,6 +7,9 @@ namespace ReactiveUI.Tests { + /// + /// A strange interface. + /// [SuppressMessage("Design", "CA1040: Avoid empty interfaces", Justification = "Deliberate empty interface.")] public interface IStrangeInterfaceNotFollowingConvention { diff --git a/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooCustomView.cs b/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooCustomView.cs index 674f2ce00b..02a19ea625 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooCustomView.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooCustomView.cs @@ -5,14 +5,19 @@ namespace ReactiveUI.Tests { + /// + /// A routable view. + /// public class RoutableFooCustomView : IViewFor { + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (IRoutableFooViewModel?)value; } + /// public IRoutableFooViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooView.cs b/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooView.cs index 3e9e6b4c4b..a1616aa11d 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooView.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooView.cs @@ -5,14 +5,19 @@ namespace ReactiveUI.Tests { + /// + /// A routable view. + /// public class RoutableFooView : IViewFor { + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (IRoutableFooViewModel?)value; } + /// public IRoutableFooViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooViewModel.cs b/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooViewModel.cs index eaf5542db9..c91001be39 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooViewModel.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/RoutableFooViewModel.cs @@ -5,10 +5,15 @@ namespace ReactiveUI.Tests { + /// + /// A routable view model. + /// public class RoutableFooViewModel : ReactiveObject, IRoutableFooViewModel { + /// public IScreen HostScreen { get; set; } = new TestScreen(); + /// public string? UrlPathSegment { get; set; } } } diff --git a/src/ReactiveUI.Tests/Locator/Mocks/StrangeClassNotFollowingConvention.cs b/src/ReactiveUI.Tests/Locator/Mocks/StrangeClassNotFollowingConvention.cs index ee431b38e9..0c1e9faf3d 100644 --- a/src/ReactiveUI.Tests/Locator/Mocks/StrangeClassNotFollowingConvention.cs +++ b/src/ReactiveUI.Tests/Locator/Mocks/StrangeClassNotFollowingConvention.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A strange class. + /// public class StrangeClassNotFollowingConvention : IStrangeInterfaceNotFollowingConvention { } diff --git a/src/ReactiveUI.Tests/MessageBusTest.cs b/src/ReactiveUI.Tests/MessageBusTest.cs index 0f2fc9f83b..9920adb786 100644 --- a/src/ReactiveUI.Tests/MessageBusTest.cs +++ b/src/ReactiveUI.Tests/MessageBusTest.cs @@ -15,8 +15,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests the MessageBus class. + /// public class MessageBusTest { + /// + /// Smoke tests the MessageBus. + /// [Fact] public void MessageBusSmokeTest() { @@ -42,6 +48,9 @@ public void MessageBusSmokeTest() input.AssertAreEqual(result); } + /// + /// Tests that explicits send message should work even after registering source. + /// [Fact] public void ExplicitSendMessageShouldWorkEvenAfterRegisteringSource() { @@ -55,6 +64,9 @@ public void ExplicitSendMessageShouldWorkEvenAfterRegisteringSource() Assert.True(messageReceived); } + /// + /// Tests that listening before registering a source should work. + /// [Fact] public void ListeningBeforeRegisteringASourceShouldWork() { @@ -70,6 +82,9 @@ public void ListeningBeforeRegisteringASourceShouldWork() Assert.Equal(42, result); } + /// + /// Tests that the Garbage Collector should not kill message service. + /// [Fact] public void GcShouldNotKillMessageService() { @@ -88,6 +103,9 @@ public void GcShouldNotKillMessageService() Assert.True(receivedMessage); } + /// + /// Tests that Registering the second message source should merge both sources. + /// [Fact] public void RegisteringSecondMessageSourceShouldMergeBothSources() { @@ -115,6 +133,9 @@ public void RegisteringSecondMessageSourceShouldMergeBothSources() Assert.True(receivedMessage2); } + /// + /// Tests the MessageBus threading. + /// [Fact] public void MessageBusThreadingTest() { diff --git a/src/ReactiveUI.Tests/Mocks/AnotherViewModel.cs b/src/ReactiveUI.Tests/Mocks/AnotherViewModel.cs index 8f7b9c65ca..ad6931e00b 100644 --- a/src/ReactiveUI.Tests/Mocks/AnotherViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/AnotherViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class AnotherViewModel : ReactiveObject { } diff --git a/src/ReactiveUI.Tests/Mocks/CommandBindViewModel.cs b/src/ReactiveUI.Tests/Mocks/CommandBindViewModel.cs index 28360254f2..30020f9db7 100644 --- a/src/ReactiveUI.Tests/Mocks/CommandBindViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/CommandBindViewModel.cs @@ -12,6 +12,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class CommandBindViewModel : ReactiveObject { private ReactiveCommand _Command1 = null!; @@ -19,6 +22,9 @@ public class CommandBindViewModel : ReactiveObject private int _value; + /// + /// Initializes a new instance of the class. + /// public CommandBindViewModel() { Command1 = ReactiveCommand.Create(_ => Unit.Default); @@ -26,20 +32,32 @@ public CommandBindViewModel() NestedViewModel = new FakeNestedViewModel(); } + /// + /// Gets or sets the command1. + /// public ReactiveCommand Command1 { get => _Command1; set => this.RaiseAndSetIfChanged(ref _Command1, value); } + /// + /// Gets or sets the command2. + /// public ReactiveCommand Command2 { get => _Command2; set => this.RaiseAndSetIfChanged(ref _Command2, value); } + /// + /// Gets or sets the nested view model. + /// public FakeNestedViewModel NestedViewModel { get; set; } + /// + /// Gets or sets the value. + /// public int Value { get => _value; diff --git a/src/ReactiveUI.Tests/Mocks/ExampleViewModel.cs b/src/ReactiveUI.Tests/Mocks/ExampleViewModel.cs index e4a871fbbc..3771e3fe90 100644 --- a/src/ReactiveUI.Tests/Mocks/ExampleViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/ExampleViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class ExampleViewModel : ReactiveObject { } diff --git a/src/ReactiveUI.Tests/Mocks/ExampleWindowViewModel.cs b/src/ReactiveUI.Tests/Mocks/ExampleWindowViewModel.cs index 497f4f075b..4f3d9a730d 100644 --- a/src/ReactiveUI.Tests/Mocks/ExampleWindowViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/ExampleWindowViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class ExampleWindowViewModel : ReactiveObject { } diff --git a/src/ReactiveUI.Tests/Mocks/FakeCollectionModel.cs b/src/ReactiveUI.Tests/Mocks/FakeCollectionModel.cs index e8d9ae4201..f8443c113d 100644 --- a/src/ReactiveUI.Tests/Mocks/FakeCollectionModel.cs +++ b/src/ReactiveUI.Tests/Mocks/FakeCollectionModel.cs @@ -11,18 +11,30 @@ namespace ReactiveUI.Tests { + /// + /// A collection model. + /// public class FakeCollectionModel : ReactiveObject { private bool _isHidden; private int _someNumber; + /// + /// Gets or sets a value indicating whether this instance is hidden. + /// + /// + /// true if this instance is hidden; otherwise, false. + /// public bool IsHidden { get => _isHidden; set => this.RaiseAndSetIfChanged(ref _isHidden, value); } + /// + /// Gets or sets some number. + /// public int SomeNumber { get => _someNumber; diff --git a/src/ReactiveUI.Tests/Mocks/FakeCollectionViewModel.cs b/src/ReactiveUI.Tests/Mocks/FakeCollectionViewModel.cs index c0a8e2b19d..bfa52b81d6 100644 --- a/src/ReactiveUI.Tests/Mocks/FakeCollectionViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/FakeCollectionViewModel.cs @@ -11,10 +11,17 @@ namespace ReactiveUI.Tests { + /// + /// A mock view model. + /// public class FakeCollectionViewModel : ReactiveObject { private readonly ObservableAsPropertyHelper _numberAsString; + /// + /// Initializes a new instance of the class. + /// + /// The model. public FakeCollectionViewModel(FakeCollectionModel model) { Model = model; @@ -22,8 +29,14 @@ public FakeCollectionViewModel(FakeCollectionModel model) this.WhenAny(x => x.Model.SomeNumber, x => x.Value.ToString()).ToProperty(this, x => x.NumberAsString, out _numberAsString); } + /// + /// Gets or sets the model. + /// public FakeCollectionModel Model { get; protected set; } + /// + /// Gets the number as string. + /// public string? NumberAsString => _numberAsString.Value; } } diff --git a/src/ReactiveUI.Tests/Mocks/FakeNestedViewModel.cs b/src/ReactiveUI.Tests/Mocks/FakeNestedViewModel.cs index 5e124cae01..0ca4b5d603 100644 --- a/src/ReactiveUI.Tests/Mocks/FakeNestedViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/FakeNestedViewModel.cs @@ -12,10 +12,19 @@ namespace ReactiveUI.Tests { + /// + /// A fake nested view model. + /// public class FakeNestedViewModel : ReactiveObject { + /// + /// Initializes a new instance of the class. + /// public FakeNestedViewModel() => NestedCommand = ReactiveCommand.Create(() => { }); + /// + /// Gets or sets the nested command. + /// public ReactiveCommand NestedCommand { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Mocks/FakeViewModel.cs b/src/ReactiveUI.Tests/Mocks/FakeViewModel.cs index 931cf07330..08709607e2 100644 --- a/src/ReactiveUI.Tests/Mocks/FakeViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/FakeViewModel.cs @@ -12,10 +12,19 @@ namespace ReactiveUI.Tests { + /// + /// Fake view model. + /// public class FakeViewModel : ReactiveObject { + /// + /// Initializes a new instance of the class. + /// public FakeViewModel() => Cmd = ReactiveCommand.Create(() => { }); + /// + /// Gets or sets the command. + /// public ReactiveCommand Cmd { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Mocks/InteractionAncestorView.cs b/src/ReactiveUI.Tests/Mocks/InteractionAncestorView.cs index ac586bafe6..5b774e93b7 100644 --- a/src/ReactiveUI.Tests/Mocks/InteractionAncestorView.cs +++ b/src/ReactiveUI.Tests/Mocks/InteractionAncestorView.cs @@ -5,16 +5,21 @@ namespace ReactiveUI.Tests { + /// + /// A ancestor view. + /// public class InteractionAncestorView : ReactiveObject, IViewFor { private InteractionAncestorViewModel? _viewModel; + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (InteractionAncestorViewModel?)value; } + /// public InteractionAncestorViewModel? ViewModel { get => _viewModel; diff --git a/src/ReactiveUI.Tests/Mocks/InteractionAncestorViewModel.cs b/src/ReactiveUI.Tests/Mocks/InteractionAncestorViewModel.cs index bef66c5a89..0cd1203fd1 100644 --- a/src/ReactiveUI.Tests/Mocks/InteractionAncestorViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/InteractionAncestorViewModel.cs @@ -5,17 +5,25 @@ namespace ReactiveUI.Tests { + /// + /// A ancestor view model. + /// + /// public class InteractionAncestorViewModel : ReactiveObject { private InteractionBindViewModel _interactionBindViewModel; -#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable. + /// + /// Initializes a new instance of the class. + /// public InteractionAncestorViewModel() -#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable. { - InteractionViewModel = new InteractionBindViewModel(); + _interactionBindViewModel = new InteractionBindViewModel(); } + /// + /// Gets or sets the interaction view model. + /// public InteractionBindViewModel InteractionViewModel { get => _interactionBindViewModel; diff --git a/src/ReactiveUI.Tests/Mocks/InteractionBindView.cs b/src/ReactiveUI.Tests/Mocks/InteractionBindView.cs index 94da61715f..6d24a313a4 100644 --- a/src/ReactiveUI.Tests/Mocks/InteractionBindView.cs +++ b/src/ReactiveUI.Tests/Mocks/InteractionBindView.cs @@ -5,16 +5,21 @@ namespace ReactiveUI.Tests { + /// + /// A bind view. + /// public class InteractionBindView : ReactiveObject, IViewFor { private InteractionBindViewModel? _viewModel; + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (InteractionBindViewModel?)value; } + /// public InteractionBindViewModel? ViewModel { get => _viewModel; diff --git a/src/ReactiveUI.Tests/Mocks/InteractionBindViewModel.cs b/src/ReactiveUI.Tests/Mocks/InteractionBindViewModel.cs index 60c21bf146..169ad446fc 100644 --- a/src/ReactiveUI.Tests/Mocks/InteractionBindViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/InteractionBindViewModel.cs @@ -5,17 +5,25 @@ namespace ReactiveUI.Tests { + /// + /// A bind view model. + /// + /// public class InteractionBindViewModel : ReactiveObject { private Interaction _interaction1; -#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable. + /// + /// Initializes a new instance of the class. + /// public InteractionBindViewModel() -#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable. { - Interaction1 = new Interaction(); + _interaction1 = new Interaction(); } + /// + /// Gets or sets the interaction1. + /// public Interaction Interaction1 { get => _interaction1; diff --git a/src/ReactiveUI.Tests/Mocks/NeverUsedViewModel.cs b/src/ReactiveUI.Tests/Mocks/NeverUsedViewModel.cs index 8f4650708f..9f5129d0bd 100644 --- a/src/ReactiveUI.Tests/Mocks/NeverUsedViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/NeverUsedViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A view model that is never used. + /// public class NeverUsedViewModel : ReactiveObject { } diff --git a/src/ReactiveUI.Tests/Mocks/PropertyBindModel.cs b/src/ReactiveUI.Tests/Mocks/PropertyBindModel.cs index 7e0f53963a..f37eded88f 100644 --- a/src/ReactiveUI.Tests/Mocks/PropertyBindModel.cs +++ b/src/ReactiveUI.Tests/Mocks/PropertyBindModel.cs @@ -11,10 +11,19 @@ namespace ReactiveUI.Tests { + /// + /// A property bind model. + /// public class PropertyBindModel { + /// + /// Gets or sets a thing. + /// public int AThing { get; set; } + /// + /// Gets or sets another thing. + /// public string? AnotherThing { get; set; } } } diff --git a/src/ReactiveUI.Tests/Mocks/PropertyBindViewModel.cs b/src/ReactiveUI.Tests/Mocks/PropertyBindViewModel.cs index 40c228868f..e887d52aa8 100644 --- a/src/ReactiveUI.Tests/Mocks/PropertyBindViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/PropertyBindViewModel.cs @@ -12,6 +12,10 @@ namespace ReactiveUI.Tests { + /// + /// A property bind view model. + /// + /// public class PropertyBindViewModel : ReactiveObject { private string? _Property1; @@ -23,56 +27,93 @@ public class PropertyBindViewModel : ReactiveObject private int _JustAInt32; private bool _JustABoolean; + /// + /// Initializes a new instance of the class. + /// + /// The model. public PropertyBindViewModel(PropertyBindModel? model = null) { Model = model ?? new PropertyBindModel { AThing = 42, AnotherThing = "Baz" }; SomeCollectionOfStrings = new ObservableCollectionExtended(new[] { "Foo", "Bar" }); } + /// + /// Gets or sets the property1. + /// public string? Property1 { get => _Property1; set => this.RaiseAndSetIfChanged(ref _Property1, value); } + /// + /// Gets or sets the property2. + /// public int Property2 { get => _Property2; set => this.RaiseAndSetIfChanged(ref _Property2, value); } + /// + /// Gets or sets the just a double. + /// public double JustADouble { get => _JustADouble; set => this.RaiseAndSetIfChanged(ref _JustADouble, value); } + /// + /// Gets or sets a value indicating whether [just a boolean]. + /// + /// + /// true if [just a boolean]; otherwise, false. + /// public bool JustABoolean { get => _JustABoolean; set => this.RaiseAndSetIfChanged(ref _JustABoolean, value); } + /// + /// Gets or sets the just a decimal. + /// public decimal JustADecimal { get => _JustADecimal; set => this.RaiseAndSetIfChanged(ref _JustADecimal, value); } + /// + /// Gets or sets the just a int32. + /// public int JustAInt32 { get => _JustAInt32; set => this.RaiseAndSetIfChanged(ref _JustAInt32, value); } + /// + /// Gets or sets the nullable double. + /// public double? NullableDouble { get => _NullableDouble; set => this.RaiseAndSetIfChanged(ref _NullableDouble, value); } + /// + /// Gets some collection of strings. + /// + /// + /// Some collection of strings. + /// public ObservableCollectionExtended SomeCollectionOfStrings { get; } + /// + /// Gets or sets the model. + /// public PropertyBindModel? Model { get => _Model; diff --git a/src/ReactiveUI.Tests/Mocks/SingleInstanceExampleViewModel.cs b/src/ReactiveUI.Tests/Mocks/SingleInstanceExampleViewModel.cs index a254701904..1ec52c361c 100644 --- a/src/ReactiveUI.Tests/Mocks/SingleInstanceExampleViewModel.cs +++ b/src/ReactiveUI.Tests/Mocks/SingleInstanceExampleViewModel.cs @@ -5,7 +5,10 @@ namespace ReactiveUI.Tests { - public class SingleInstanceExampleViewModel : ReactiveObject + /// + /// A single instance example view model. + /// +public class SingleInstanceExampleViewModel : ReactiveObject { } } diff --git a/src/ReactiveUI.Tests/Mocks/ViewModelWithWeirdName.cs b/src/ReactiveUI.Tests/Mocks/ViewModelWithWeirdName.cs index ad1e04a522..91254c4d99 100644 --- a/src/ReactiveUI.Tests/Mocks/ViewModelWithWeirdName.cs +++ b/src/ReactiveUI.Tests/Mocks/ViewModelWithWeirdName.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A view model with a weird name. + /// public class ViewModelWithWeirdName : ReactiveObject { } diff --git a/src/ReactiveUI.Tests/ObservableAsPropertyHelper/Mocks/OAPHIndexerTestFixture.cs b/src/ReactiveUI.Tests/ObservableAsPropertyHelper/Mocks/OAPHIndexerTestFixture.cs index 8e7025dbf5..ce07f0e73d 100644 --- a/src/ReactiveUI.Tests/ObservableAsPropertyHelper/Mocks/OAPHIndexerTestFixture.cs +++ b/src/ReactiveUI.Tests/ObservableAsPropertyHelper/Mocks/OAPHIndexerTestFixture.cs @@ -7,10 +7,16 @@ namespace ReactiveUI.Tests { + /// + /// A test fixture for OAPH. + /// internal class OAPHIndexerTestFixture : ReactiveObject { private string? _text; + /// + /// Initializes a new instance of the class. + /// public OAPHIndexerTestFixture() { var temp = this.WhenAnyValue(f => f.Text) @@ -18,12 +24,20 @@ public OAPHIndexerTestFixture() .Value; } + /// + /// Gets or sets the text. + /// public string? Text { get => _text; set => this.RaiseAndSetIfChanged(ref _text, value); } + /// + /// Gets the string with the specified property name. + /// + /// Name of the property. + /// The string. [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Used by test.")] public string? this[string propertyName] => string.Empty; } diff --git a/src/ReactiveUI.Tests/ObservableAsPropertyHelper/ObservableAsPropertyHelperTest.cs b/src/ReactiveUI.Tests/ObservableAsPropertyHelper/ObservableAsPropertyHelperTest.cs index 039452ca9e..5a2c79d1e9 100644 --- a/src/ReactiveUI.Tests/ObservableAsPropertyHelper/ObservableAsPropertyHelperTest.cs +++ b/src/ReactiveUI.Tests/ObservableAsPropertyHelper/ObservableAsPropertyHelperTest.cs @@ -18,8 +18,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the observable as property helper. + /// public class ObservableAsPropertyHelperTest { + /// + /// Tests that Observable As Property Helpers should fire change notifications. + /// [Fact] public void OAPHShouldFireChangeNotifications() { @@ -43,6 +49,9 @@ public void OAPHShouldFireChangeNotifications() }); } + /// + /// Tests that Observable As Property Helpers should skip first value if it matches the initial value. + /// [Fact] public void OAPHShouldSkipFirstValueIfItMatchesTheInitialValue() { @@ -64,6 +73,9 @@ public void OAPHShouldSkipFirstValueIfItMatchesTheInitialValue() }); } + /// + /// Tests that Observable As Property Helpers should provide initial value immediately regardless of scheduler. + /// [Fact] public void OAPHShouldProvideInitialValueImmediatelyRegardlessOfScheduler() { @@ -80,6 +92,9 @@ public void OAPHShouldProvideInitialValueImmediatelyRegardlessOfScheduler() }); } + /// + /// Tests that Observable As Property Helpers should provide latest value. + /// [Fact] public void OAPHShouldProvideLatestValue() { @@ -103,6 +118,9 @@ public void OAPHShouldProvideLatestValue() Assert.Equal(4, fixture.Value); } + /// + /// Tests that Observable As Property Helpers should subscribe immediately to source. + /// [Fact] public void OAPHShouldSubscribeImmediatelyToSource() { @@ -123,6 +141,9 @@ public void OAPHShouldSubscribeImmediatelyToSource() Assert.Equal(42, fixture.Value); } + /// + /// Tests that Observable As Property Helpers defer subscription parameter defers subscription to source. + /// [Fact] public void OAPHDeferSubscriptionParameterDefersSubscriptionToSource() { @@ -144,6 +165,9 @@ public void OAPHDeferSubscriptionParameterDefersSubscriptionToSource() Assert.True(isSubscribed); } + /// + /// Tests that Observable As Property Helpers defer subscription parameter is subscribed is not true initially. + /// [Fact] public void OAPHDeferSubscriptionParameterIsSubscribedIsNotTrueInitially() { @@ -162,6 +186,9 @@ public void OAPHDeferSubscriptionParameterIsSubscribedIsNotTrueInitially() Assert.True(fixture.IsSubscribed); } + /// + /// Tests that Observable As Property Helpers defer subscription should not throw if disposed. + /// [Fact] public void OAPHDeferSubscriptionShouldNotThrowIfDisposed() { @@ -181,6 +208,10 @@ public void OAPHDeferSubscriptionShouldNotThrowIfDisposed() Assert.Null(ex); } + /// + /// Tests that Observable As Property Helpers defer subscription with initial value should not emit initial value. + /// + /// The initial value. [Theory] [InlineData(default(int))] [InlineData(42)] @@ -198,6 +229,9 @@ public void OAPHDeferSubscriptionWithInitialValueShouldNotEmitInitialValue(int i Assert.False(fixture.IsSubscribed); } + /// + /// Tests that Observable As Property Helpers defer subscription with initial function value should not emit initial value nor access function. + /// [Fact] public void OAPHDeferSubscriptionWithInitialFuncValueShouldNotEmitInitialValueNorAccessFunc() { @@ -214,6 +248,10 @@ public void OAPHDeferSubscriptionWithInitialFuncValueShouldNotEmitInitialValueNo Assert.False(fixture.IsSubscribed); } + /// + /// Tests that Observable As Property Helpers defer subscription with initial value emit initial value when subscribed. + /// + /// The initial value. [Theory] [InlineData(default(int))] [InlineData(42)] @@ -230,6 +268,9 @@ public void OAPHDeferSubscriptionWithInitialValueEmitInitialValueWhenSubscribed( Assert.Equal(initialValue, result); } + /// + /// Test that Observable As Property Helpers defers subscription with initial function value emit initial value when subscribed. + /// [Fact] public void OAPHDeferSubscriptionWithInitialFuncValueEmitInitialValueWhenSubscribed() { @@ -252,6 +293,10 @@ public void OAPHDeferSubscriptionWithInitialFuncValueEmitInitialValueWhenSubscri Assert.Equal(42, result); } + /// + /// Tests that Observable As Property Helpers initial value should emit initial value. + /// + /// The initial value. [Theory] [InlineData(default(int))] [InlineData(42)] @@ -268,6 +313,9 @@ public void OAPHInitialValueShouldEmitInitialValue(int initialValue) Assert.Equal(initialValue, emittedValue); } + /// + /// Tests that Observable As Property Helpers should rethrow errors. + /// [Fact] public void OAPHShouldRethrowErrors() { @@ -294,6 +342,9 @@ public void OAPHShouldRethrowErrors() Assert.Equal(1, errors.Count); } + /// + /// Test that no thrown exceptions subscriber equals Observable As Property Helper death. + /// [Fact] public void NoThrownExceptionsSubscriberEqualsOAPHDeath() => new TestScheduler().With(scheduler => @@ -320,6 +371,9 @@ public void NoThrownExceptionsSubscriberEqualsOAPHDeath() => Assert.Equal(4, fixture.Value); }); + /// + /// Tests that the ToProperty should fire both changing and changed events. + /// [Fact] public void ToPropertyShouldFireBothChangingAndChanged() { @@ -349,6 +403,9 @@ public void ToPropertyShouldFireBothChangingAndChanged() Assert.Equal("Baz", resultChanged[1].Value); } + /// + /// Tests that the ToProperty nameof override should fire both changing and changed events. + /// [Fact] public void ToProperty_NameOf_ShouldFireBothChangingAndChanged() { @@ -369,6 +426,12 @@ public void ToProperty_NameOf_ShouldFireBothChangingAndChanged() Assert.True(changed); } + /// + /// Test to make sure that the ToProperty nameof override produces valid values. + /// + /// The test words. + /// The first3 letters. + /// The last3 letters. [Theory] [InlineData(new string[] { "FooBar", "Bazz" }, new string[] { "Foo", "Baz" }, new string[] { "Bar", "azz" })] public void ToProperty_NameOf_ValidValuesProduced(string[] testWords, string[] first3Letters, string[] last3Letters) @@ -419,6 +482,9 @@ public void ToProperty_NameOf_ValidValuesProduced(string[] testWords, string[] f } } + /// + /// Tests to make sure that the ToProperty with a indexer notifies the expected property name. + /// [Fact] public void ToProperty_GivenIndexer_NotifiesOnExpectedPropertyName() => new TestScheduler().With(scheduler => diff --git a/src/ReactiveUI.Tests/ObservedChanged/Mocks/NewGameViewModel.cs b/src/ReactiveUI.Tests/ObservedChanged/Mocks/NewGameViewModel.cs index 6b0e3c8c97..d87ae2b056 100644 --- a/src/ReactiveUI.Tests/ObservedChanged/Mocks/NewGameViewModel.cs +++ b/src/ReactiveUI.Tests/ObservedChanged/Mocks/NewGameViewModel.cs @@ -11,10 +11,17 @@ namespace ReactiveUI.Tests { + /// + /// A sample view model that implements a game. + /// + /// public class NewGameViewModel : ReactiveObject { private string? _newPlayerName; + /// + /// Initializes a new instance of the class. + /// public NewGameViewModel() { Players = new ObservableCollectionExtended(); @@ -53,16 +60,34 @@ public NewGameViewModel() canAddPlayer); } + /// + /// Gets the players collection. + /// public ObservableCollectionExtended Players { get; } + /// + /// Gets the add player command. + /// public ReactiveCommand AddPlayer { get; } + /// + /// Gets the remove player command. + /// public ReactiveCommand RemovePlayer { get; } + /// + /// Gets the start game command. + /// public ReactiveCommand StartGame { get; } + /// + /// Gets the randomize order command. + /// public ReactiveCommand RandomizeOrder { get; } + /// + /// Gets or sets the new player name. + /// public string? NewPlayerName { get => _newPlayerName; diff --git a/src/ReactiveUI.Tests/ObservedChanged/NewGameViewModelTests.cs b/src/ReactiveUI.Tests/ObservedChanged/NewGameViewModelTests.cs index f1801a4bf2..dffa91bad5 100644 --- a/src/ReactiveUI.Tests/ObservedChanged/NewGameViewModelTests.cs +++ b/src/ReactiveUI.Tests/ObservedChanged/NewGameViewModelTests.cs @@ -9,12 +9,21 @@ namespace ReactiveUI.Tests { + /// + /// Tests for a sample game. + /// public class NewGameViewModelTests { private readonly NewGameViewModel _viewmodel; + /// + /// Initializes a new instance of the class. + /// public NewGameViewModelTests() => _viewmodel = new NewGameViewModel(); + /// + /// Tests that determines whether this instance [can add up to seven players]. + /// [Fact] public void CanAddUpToSevenPlayers() { diff --git a/src/ReactiveUI.Tests/ObservedChanged/ObservedChangedMixinTest.cs b/src/ReactiveUI.Tests/ObservedChanged/ObservedChangedMixinTest.cs index 15c3f698a1..48da5d6e23 100644 --- a/src/ReactiveUI.Tests/ObservedChanged/ObservedChangedMixinTest.cs +++ b/src/ReactiveUI.Tests/ObservedChanged/ObservedChangedMixinTest.cs @@ -14,8 +14,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the ObservedChangedMixin. + /// public class ObservedChangedMixinTest { + /// + /// Tests that getting the value should actually return the value. + /// [Fact] public void GetValueShouldActuallyReturnTheValue() { @@ -46,6 +52,9 @@ public void GetValueShouldActuallyReturnTheValue() }); } + /// + /// Tests that getting the value should return the value from a path. + /// [Fact] public void GetValueShouldReturnTheValueFromAPath() { @@ -60,6 +69,9 @@ public void GetValueShouldReturnTheValueFromAPath() Assert.Equal("Foo", fixture.GetValue()); } + /// + /// Runs a smoke test that sets the value path. + /// [Fact] public void SetValuePathSmokeTest() { @@ -75,6 +87,9 @@ public void SetValuePathSmokeTest() Assert.Equal("Bar", output.Child.IsNotNullString); } + /// + /// Runs a smoke test for the BindTo functionality. + /// [Fact] public void BindToSmokeTest() => new TestScheduler().With(scheduler => @@ -95,6 +110,9 @@ public void BindToSmokeTest() => Assert.Equal("Bar", fixture.Child.IsNotNullString); }); + /// + /// Tests to make sure that Disposing disconnects BindTo and updates are no longer pushed. + /// [Fact] public void DisposingDisconnectsTheBindTo() => new TestScheduler().With(scheduler => @@ -117,6 +135,9 @@ public void DisposingDisconnectsTheBindTo() => Assert.Equal("Foo", fixture.Child.IsNotNullString); }); + /// + /// Tests to make sure that BindTo can handle intermediate object switching. + /// [Fact] public void BindToIsNotFooledByIntermediateObjectSwitching() => new TestScheduler().With(scheduler => @@ -141,6 +162,9 @@ public void BindToIsNotFooledByIntermediateObjectSwitching() => Assert.Equal("Bar", fixture.Child.IsNotNullString); }); + /// + /// Tests to make sure that BindTo can handle Stack Overflow conditions. + /// [Fact] public void BindToStackOverFlowTest() { diff --git a/src/ReactiveUI.Tests/Platforms/android/MainActivity.cs b/src/ReactiveUI.Tests/Platforms/android/MainActivity.cs index 5d3d8dab04..68078e257e 100644 --- a/src/ReactiveUI.Tests/Platforms/android/MainActivity.cs +++ b/src/ReactiveUI.Tests/Platforms/android/MainActivity.cs @@ -16,9 +16,13 @@ namespace ReactiveUI.Tests { + /// + /// The main activity for the tests. + /// [Activity(Label = "xUnit Android Runner", MainLauncher = true)] public class MainActivity : RunnerActivity { + /// protected override void OnCreate(Bundle bundle) { // tests can be inside the main assembly diff --git a/src/ReactiveUI.Tests/Platforms/android/PropertyBindingTestViews.cs b/src/ReactiveUI.Tests/Platforms/android/PropertyBindingTestViews.cs index ae539c5d63..7ab05591d0 100644 --- a/src/ReactiveUI.Tests/Platforms/android/PropertyBindingTestViews.cs +++ b/src/ReactiveUI.Tests/Platforms/android/PropertyBindingTestViews.cs @@ -19,6 +19,9 @@ namespace ReactiveUI.Tests { + /// + /// Property binding views. + /// public class PropertyBindView : ReactiveFragment { public PropertyBindView() @@ -28,31 +31,53 @@ public PropertyBindView() FakeControl = new PropertyBindFakeControl(); } + /// + /// Gets or sets some text box. + /// public TextView SomeTextBox { get; set; } + /// + /// Gets or sets the property2. + /// public TextView Property2 { get; set; } + /// + /// Gets or sets the fake control. + /// public PropertyBindFakeControl FakeControl { get; set; } } + /// + /// A fake control. + /// public class PropertyBindFakeControl : ReactiveFragment, INotifyPropertyChanged { private double? _NullableDouble; private double _JustADouble; private string _NullHatingString = string.Empty; + /// + /// Gets or sets the nullable double. + /// public double? NullableDouble { get { return _NullableDouble; } set { this.RaiseAndSetIfChanged(ref _NullableDouble, value); } } + /// + /// Gets or sets the just a double. + /// public double JustADouble { get { return _JustADouble; } set { this.RaiseAndSetIfChanged(ref _JustADouble, value); } } + /// + /// Gets or sets the null hating string. + /// + /// The value. public string NullHatingString { get diff --git a/src/ReactiveUI.Tests/Platforms/cocoa/AppDelegate.cs b/src/ReactiveUI.Tests/Platforms/cocoa/AppDelegate.cs index 42bd3f884c..447ec88388 100644 --- a/src/ReactiveUI.Tests/Platforms/cocoa/AppDelegate.cs +++ b/src/ReactiveUI.Tests/Platforms/cocoa/AppDelegate.cs @@ -14,9 +14,11 @@ namespace ReactiveUI.Tests { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. + /// + /// The UIApplicationDelegate for the application. This class is responsible for launching the + /// User Interface of the application, as well as listening (and optionally responding) to + /// application events from iOS. + /// [Foundation.Register("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { @@ -31,6 +33,8 @@ public partial class AppDelegate : UIApplicationDelegate // // You have 17 seconds to return from this method, or iOS will terminate your application. // + + /// public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create a new window instance based on the screen size diff --git a/src/ReactiveUI.Tests/Platforms/cocoa/IndexNormalizerTest.cs b/src/ReactiveUI.Tests/Platforms/cocoa/IndexNormalizerTest.cs index 93d445c5b6..cbd3ecf5bd 100644 --- a/src/ReactiveUI.Tests/Platforms/cocoa/IndexNormalizerTest.cs +++ b/src/ReactiveUI.Tests/Platforms/cocoa/IndexNormalizerTest.cs @@ -12,8 +12,16 @@ namespace ReactiveUI.Tests using ReactiveUI; using Xunit; + /// + /// Tests for the different indexes on the cocoa platform. + /// public class IndexNormalizerTest { + /// + /// Tests to make sure that the index updates are correctly normalized. + /// + /// The input updates string. + /// The expected output updates string. [Theory] [InlineData("", "")] [InlineData("D0:D0", "D0:D1")] diff --git a/src/ReactiveUI.Tests/Platforms/cocoa/KVOBindingTests.cs b/src/ReactiveUI.Tests/Platforms/cocoa/KVOBindingTests.cs index 63ac9cd77b..38212337e3 100644 --- a/src/ReactiveUI.Tests/Platforms/cocoa/KVOBindingTests.cs +++ b/src/ReactiveUI.Tests/Platforms/cocoa/KVOBindingTests.cs @@ -9,22 +9,38 @@ namespace ReactiveUI.Tests { + /// + /// A sample controller. + /// public class FooController : ReactiveViewController, IViewFor { - PropertyBindViewModel _ViewModel; + private PropertyBindViewModel _viewModel; + + /// + /// Gets or sets the view model. + /// public PropertyBindViewModel ViewModel { - get { return _ViewModel; } - set { this.RaiseAndSetIfChanged(ref _ViewModel, value); } + get { return _viewModel; } + set { this.RaiseAndSetIfChanged(ref _viewModel, value); } } + /// + /// Gets or sets the view model. + /// object IViewFor.ViewModel { get { return ViewModel; } set { ViewModel = (PropertyBindViewModel)value; } } } + /// + /// Tests for checking KVO bindings. + /// public class KVOBindingTests { + /// + /// Makes the sure kvo bindings bind to kvo things. + /// [Fact] public void MakeSureKVOBindingsBindToKVOThings() { diff --git a/src/ReactiveUI.Tests/Platforms/cocoa/Main.cs b/src/ReactiveUI.Tests/Platforms/cocoa/Main.cs index 4d91c4b876..e52b53f1fc 100644 --- a/src/ReactiveUI.Tests/Platforms/cocoa/Main.cs +++ b/src/ReactiveUI.Tests/Platforms/cocoa/Main.cs @@ -11,10 +11,16 @@ namespace ReactiveUI.Tests_iOS { + /// + /// The main application class. + /// public class Application { - // This is the main entry point of the application. - static void Main(string[] args) + /// + /// Defines the entry point of the application. + /// + /// The arguments. + public static void Main(string[] args) { // if you want to use a different Application Delegate class from "UnitTestAppDelegate" // you can specify it here. diff --git a/src/ReactiveUI.Tests/Platforms/cocoa/PropertyBindingTestViews.cs b/src/ReactiveUI.Tests/Platforms/cocoa/PropertyBindingTestViews.cs index 724c9293cb..a7f729ef5e 100644 --- a/src/ReactiveUI.Tests/Platforms/cocoa/PropertyBindingTestViews.cs +++ b/src/ReactiveUI.Tests/Platforms/cocoa/PropertyBindingTestViews.cs @@ -16,6 +16,9 @@ namespace ReactiveUI.Tests { + /// + /// A test view. + /// public class PropertyBindView : ReactiveViewController, IViewFor { PropertyBindViewModel _ViewModel; diff --git a/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionFixture.cs b/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionFixture.cs index fcf135cbe5..5a9dcd26ef 100644 --- a/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionFixture.cs +++ b/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionFixture.cs @@ -7,10 +7,17 @@ namespace ReactiveUI.Tests { + /// + /// A fixture for demonstrating race conditions. + /// + /// public class RaceConditionFixture : ReactiveObject { private readonly ObservableAsPropertyHelper _A; + /// + /// Initializes a new instance of the class. + /// public RaceConditionFixture() { // We need to generate a value on subscription @@ -21,8 +28,17 @@ public RaceConditionFixture() Observables.True.Do(_ => Count++).ToProperty(this, x => x.A, out _A); } + /// + /// Gets or sets the count. + /// public int Count { get; set; } + /// + /// Gets a value indicating whether this is a. + /// + /// + /// true if a; otherwise, false. + /// public bool A => _A.Value; } } diff --git a/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionNameOfFixture.cs b/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionNameOfFixture.cs index f4ff3f1726..a9cd0394f6 100644 --- a/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionNameOfFixture.cs +++ b/src/ReactiveUI.Tests/Platforms/common-gui/Mocks/RaceConditionNameOfFixture.cs @@ -7,10 +7,16 @@ namespace ReactiveUI.Tests { + /// + /// A fixture for RaceCondition and NameOf. + /// public class RaceConditionNameOfFixture : ReactiveObject { private readonly ObservableAsPropertyHelper _A; + /// + /// Initializes a new instance of the class. + /// public RaceConditionNameOfFixture() => // We need to generate a value on subscription @@ -23,8 +29,17 @@ public RaceConditionNameOfFixture() => .Do(_ => Count++) .ToProperty(this, nameof(A), out _A); + /// + /// Gets or sets the count. + /// public int Count { get; set; } + /// + /// Gets a value indicating whether this is a. + /// + /// + /// true if a; otherwise, false. + /// public bool A => _A.Value; } } diff --git a/src/ReactiveUI.Tests/Platforms/common-gui/ObservableAsPropertyHelperModeTests.cs b/src/ReactiveUI.Tests/Platforms/common-gui/ObservableAsPropertyHelperModeTests.cs index a0a4420462..d7370f3132 100644 --- a/src/ReactiveUI.Tests/Platforms/common-gui/ObservableAsPropertyHelperModeTests.cs +++ b/src/ReactiveUI.Tests/Platforms/common-gui/ObservableAsPropertyHelperModeTests.cs @@ -8,8 +8,14 @@ namespace ReactiveUI.Tests { + /// + /// OAPH mode tests. + /// public class ObservableAsPropertyHelperModeTests { + /// + /// Tests that ToProperty should only subscribe only once. + /// [Fact] public void ToPropertyShouldSubscribeOnlyOnce() { @@ -30,6 +36,9 @@ public void ToPropertyShouldSubscribeOnlyOnce() } } + /// + /// Tests to make sure that ToProperty overload with the nameof only subscribes once. + /// [Fact] public void ToProperty_NameOf_ShouldSubscribeOnlyOnce() { diff --git a/src/ReactiveUI.Tests/Platforms/common-gui/ProductionMode.cs b/src/ReactiveUI.Tests/Platforms/common-gui/ProductionMode.cs index 4346a37ce6..bf74016b74 100644 --- a/src/ReactiveUI.Tests/Platforms/common-gui/ProductionMode.cs +++ b/src/ReactiveUI.Tests/Platforms/common-gui/ProductionMode.cs @@ -9,10 +9,17 @@ namespace ReactiveUI.Tests { + /// + /// Detects if we are in production mode or not. + /// internal class ProductionMode : IModeDetector, IPlatformModeDetector { private static readonly ProductionMode Instance = new(); + /// + /// Sets the platform mode. + /// + /// A disposable to revert to the previous state. public static IDisposable Set() { PlatformModeDetector.OverrideModeDetector(Instance); @@ -24,8 +31,16 @@ public static IDisposable Set() }); } + /// + /// Value indicating whether we are in the unit test runner. + /// + /// If we are in test mode. public bool? InUnitTestRunner() => false; + /// + /// Value indicating whether we are in the design mode. + /// + /// If we are in design mode. public bool? InDesignMode() => false; } } diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Api/XamlApiApprovalTests.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Api/XamlApiApprovalTests.cs index fac29d2f34..53847e8740 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Api/XamlApiApprovalTests.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Api/XamlApiApprovalTests.cs @@ -10,9 +10,15 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// API approvals for the xaml project. + /// [ExcludeFromCodeCoverage] public class XamlApiApprovalTests : ApiApprovalBase { + /// + /// Generates the public API for the blend project. + /// [Fact] public void Blend() => CheckApproval(typeof(Blend.FollowObservableStateBehavior).Assembly); } diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/CommandBindingImplementationTests.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/CommandBindingImplementationTests.cs index 32107ec395..8795b98513 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/CommandBindingImplementationTests.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/CommandBindingImplementationTests.cs @@ -19,8 +19,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Tests with the command binding implementation. + /// public class CommandBindingImplementationTests { + /// + /// Tests the command bind by name wireup. + /// [Fact] public void CommandBindByNameWireup() { @@ -40,6 +46,9 @@ public void CommandBindByNameWireup() Assert.Null(view.Command1.Command); } + /// + /// Tests the command bind nested command wireup. + /// [Fact] public void CommandBindNestedCommandWireup() { @@ -55,6 +64,9 @@ public void CommandBindNestedCommandWireup() Assert.Equal(vm.NestedViewModel.NestedCommand, view.Command1.Command); } + /// + /// Tests the command bind sets initial enabled state true. + /// [Fact] public void CommandBindSetsInitialEnabledState_True() { @@ -69,6 +81,9 @@ public void CommandBindSetsInitialEnabledState_True() Assert.True(view.Command1.IsEnabled); } + /// + /// Tests the command bind sets disables command when can execute changed. + /// [Fact] public void CommandBindSetsDisablesCommandWhenCanExecuteChanged() { @@ -87,6 +102,9 @@ public void CommandBindSetsDisablesCommandWhenCanExecuteChanged() Assert.False(view.Command1.IsEnabled); } + /// + /// Tests the command bind sets initial enabled state false. + /// [Fact] public void CommandBindSetsInitialEnabledState_False() { @@ -101,6 +119,9 @@ public void CommandBindSetsInitialEnabledState_False() Assert.False(view.Command1.IsEnabled); } + /// + /// Tests the command bind raises can execute changed on bind. + /// [Fact] public void CommandBindRaisesCanExecuteChangedOnBind() { @@ -121,6 +142,9 @@ public void CommandBindRaisesCanExecuteChangedOnBind() Assert.False(view.Command1.IsEnabled); } + /// + /// Tests the command bind with parameter expression. + /// [Fact] public void CommandBindWithParameterExpression() { @@ -142,6 +166,9 @@ public void CommandBindWithParameterExpression() Assert.Equal(13, received); } + /// + /// Tests the command bind with delay set vm parameter expression. + /// [Fact] public void CommandBindWithDelaySetVMParameterExpression() { @@ -165,6 +192,9 @@ public void CommandBindWithDelaySetVMParameterExpression() Assert.Equal(13, received); } + /// + /// Tests the command bind with delay set vm parameter no inpc expression. + /// [Fact] public void CommandBindWithDelaySetVMParameterNoINPCExpression() { @@ -188,6 +218,9 @@ public void CommandBindWithDelaySetVMParameterNoINPCExpression() Assert.Equal(0, received); } + /// + /// Tests the command bind with parameter observable. + /// [Fact] public void CommandBindWithParameterObservable() { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/DependencyObjectObservableForPropertyTest.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/DependencyObjectObservableForPropertyTest.cs index 72a8e02fea..363ac4bab7 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/DependencyObjectObservableForPropertyTest.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/DependencyObjectObservableForPropertyTest.cs @@ -22,8 +22,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Tests for the dependency object property binding. + /// public class DependencyObjectObservableForPropertyTest { + /// + /// Runs a smoke test for dependency object observables for property. + /// [Fact] public void DependencyObjectObservableForPropertySmokeTest() { @@ -53,6 +59,9 @@ public void DependencyObjectObservableForPropertySmokeTest() disp2.Dispose(); } + /// + /// Runs a smoke test for derived dependency object observables for property. + /// [Fact] public void DerivedDependencyObjectObservableForPropertySmokeTest() { @@ -82,6 +91,9 @@ public void DerivedDependencyObjectObservableForPropertySmokeTest() disp2.Dispose(); } + /// + /// Tests WhenAny with dependency object test. + /// [Fact] public void WhenAnyWithDependencyObjectTest() { @@ -96,6 +108,9 @@ public void WhenAnyWithDependencyObjectTest() Assert.True(inputs.Zip(outputs.Skip(1), (expected, actual) => expected == actual).All(x => x)); } + /// + /// Tests ListBoxes the selected item test. + /// [Fact] public void ListBoxSelectedItemTest() { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CommandBindView.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CommandBindView.cs index efa21f71ed..1cf4560a02 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CommandBindView.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CommandBindView.cs @@ -19,24 +19,38 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Mock command binding view. + /// public class CommandBindView : IViewFor { + /// + /// Initializes a new instance of the class. + /// public CommandBindView() { Command1 = new CustomClickButton(); Command2 = new Image(); } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (CommandBindViewModel?)value; } + /// public CommandBindViewModel? ViewModel { get; set; } + /// + /// Gets or sets the command1. + /// public CustomClickButton Command1 { get; protected set; } + /// + /// Gets or sets the command2. + /// public Image Command2 { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CustomClickButton.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CustomClickButton.cs index 6eebcab4d6..f186f2d5c4 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CustomClickButton.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/CustomClickButton.cs @@ -19,10 +19,19 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A button for custom clicking. + /// public class CustomClickButton : Button { + /// + /// Occurs when [custom click]. + /// public event EventHandler? CustomClick; + /// + /// Raises the custom click. + /// public void RaiseCustomClick() => CustomClick?.Invoke(this, EventArgs.Empty); } diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DepObjFixture.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DepObjFixture.cs index 57926d8f4c..ca7d2a2851 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DepObjFixture.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DepObjFixture.cs @@ -19,11 +19,20 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A dependency object fixture. + /// public class DepObjFixture : FrameworkElement { + /// + /// The test string property. + /// public static readonly DependencyProperty TestStringProperty = DependencyProperty.Register("TestString", typeof(string), typeof(DepObjFixture), new PropertyMetadata(null)); + /// + /// Gets or sets the test string. + /// public string TestString { get => (string)GetValue(TestStringProperty); diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DerivedDepObjFixture.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DerivedDepObjFixture.cs index 1c31a5cd5b..6af9f0fede 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DerivedDepObjFixture.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/DerivedDepObjFixture.cs @@ -16,11 +16,20 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A derived dependency object. + /// public class DerivedDepObjFixture : DepObjFixture { + /// + /// Another test string property. + /// public static readonly DependencyProperty AnotherTestStringProperty = DependencyProperty.Register("AnotherTestString", typeof(string), typeof(DerivedDepObjFixture), new PropertyMetadata(null)); + /// + /// Gets or sets another test string. + /// public string AnotherTestString { get => (string)GetValue(AnotherTestStringProperty); diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/FakeView.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/FakeView.cs index 1d9250fcf3..81b065a624 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/FakeView.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/FakeView.cs @@ -18,22 +18,33 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A fake view. + /// public class FakeView : IViewFor { + /// + /// Initializes a new instance of the class. + /// public FakeView() { TheTextBox = new TextBox(); ViewModel = new FakeViewModel(); } + /// + /// Gets or sets the text box. + /// public TextBox TheTextBox { get; protected set; } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (FakeViewModel?)value; } + /// public FakeViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/HostTestView.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/HostTestView.cs index 2001a923a3..5918fc934e 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/HostTestView.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/HostTestView.cs @@ -13,16 +13,24 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A host test view. + /// public class HostTestView : Control, IViewFor { + /// + /// The view model property. + /// public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(HostTestFixture), typeof(HostTestView), new PropertyMetadata(null)); + /// public HostTestFixture? ViewModel { get => (HostTestFixture)GetValue(ViewModelProperty); set => SetValue(ViewModelProperty, value); } + /// object? IViewFor.ViewModel { get => ViewModel; diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindFakeControl.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindFakeControl.cs index dabd949203..cbd265ada6 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindFakeControl.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindFakeControl.cs @@ -19,29 +19,50 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A fake view for property binding. + /// public class PropertyBindFakeControl : Control { + /// + /// The null hating string property. + /// public static readonly DependencyProperty NullHatingStringProperty = DependencyProperty.Register("NullHatingString", typeof(string), typeof(PropertyBindFakeControl), new PropertyMetadata(string.Empty)); + /// + /// The nullable double property. + /// public static readonly DependencyProperty NullableDoubleProperty = DependencyProperty.Register("NullableDouble", typeof(double?), typeof(PropertyBindFakeControl), new PropertyMetadata(null)); + /// + /// The just a double property. + /// public static readonly DependencyProperty JustADoubleProperty = DependencyProperty.Register("JustADouble", typeof(double), typeof(PropertyBindFakeControl), new PropertyMetadata(0.0)); + /// + /// Gets or sets the nullable double. + /// public double? NullableDouble { get => (double?)GetValue(NullableDoubleProperty); set => SetValue(NullableDoubleProperty, value); } + /// + /// Gets or sets the just a double. + /// public double JustADouble { get => (double)GetValue(JustADoubleProperty); set => SetValue(JustADoubleProperty, value); } + /// + /// Gets or sets the null hating string. + /// public string NullHatingString { get => (string)GetValue(NullHatingStringProperty); diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindView.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindView.cs index 49e0ba3c19..5f2dea4c19 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindView.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/PropertyBindView.cs @@ -19,11 +19,20 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A property binding view. + /// public class PropertyBindView : Control, IViewFor { + /// + /// The view model property. + /// public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(PropertyBindViewModel), typeof(PropertyBindView), new PropertyMetadata(null)); + /// + /// Initializes a new instance of the class. + /// public PropertyBindView() { SomeTextBox = new TextBox(); @@ -32,20 +41,34 @@ public PropertyBindView() FakeItemsControl = new ListBox(); } + /// + /// Gets or sets some text box. + /// public TextBox SomeTextBox { get; set; } + /// + /// Gets or sets the property2. + /// public TextBox Property2 { get; set; } + /// + /// Gets or sets the fake control. + /// public PropertyBindFakeControl FakeControl { get; set; } + /// + /// Gets or sets the fake items control. + /// public ListBox FakeItemsControl { get; set; } + /// public PropertyBindViewModel? ViewModel { get => (PropertyBindViewModel)GetValue(ViewModelProperty); set => SetValue(ViewModelProperty, value); } + /// object? IViewFor.ViewModel { get => ViewModel; diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/ReactiveObjectCommandBindView.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/ReactiveObjectCommandBindView.cs index b838fa960d..2ec6c1c252 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/ReactiveObjectCommandBindView.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Mocks/ReactiveObjectCommandBindView.cs @@ -19,30 +19,44 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// A view for the reactive object and commands. + /// public class ReactiveObjectCommandBindView : ReactiveObject, IViewFor { private CommandBindViewModel? _vm; + /// + /// Initializes a new instance of the class. + /// public ReactiveObjectCommandBindView() { Command1 = new CustomClickButton(); Command2 = new Image(); } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (CommandBindViewModel?)value; } + /// public CommandBindViewModel? ViewModel { get => _vm; set => this.RaiseAndSetIfChanged(ref _vm, value); } + /// + /// Gets or sets the command1. + /// public CustomClickButton Command1 { get; protected set; } + /// + /// Gets or sets the command2. + /// public Image Command2 { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/PropertyBindingTest.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/PropertyBindingTest.cs index 8d92a3ef26..3a49cac01d 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/PropertyBindingTest.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/PropertyBindingTest.cs @@ -18,8 +18,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Tests property bindings. + /// public class PropertyBindingTest { + /// + /// Performs a smoke test with two way binding with func converter. + /// [Fact] [UseInvariantCulture] public void TwoWayBindWithFuncConvertersSmokeTest() @@ -46,6 +52,9 @@ public void TwoWayBindWithFuncConvertersSmokeTest() Assert.Equal("567.89", view.SomeTextBox.Text); } + /// + /// Performs a smoke test with two way binding. + /// [Fact] public void TwoWayBindSmokeTest() { @@ -71,6 +80,9 @@ public void TwoWayBindSmokeTest() Assert.NotEqual(vm.Property1, view.SomeTextBox.Text); } + /// + /// Performs a smoke test with two way binding with a type converter. + /// [Fact] public void TypeConvertedTwoWayBindSmokeTest() { @@ -134,6 +146,9 @@ public void TypeConvertedTwoWayBindSmokeTest() Assert.Equal(13, vm.JustAInt32); } + /// + /// Tests binding into model objects. + /// [Fact] public void BindingIntoModelObjects() { @@ -144,6 +159,9 @@ public void BindingIntoModelObjects() Assert.Equal("Baz", view.SomeTextBox.Text); } + /// + /// Tests the view model nullable to view non nullable. + /// [Fact] public void ViewModelNullableToViewNonNullable() { @@ -163,6 +181,9 @@ public void ViewModelNullableToViewNonNullable() Assert.Equal(0.0, view.FakeControl.JustADouble); } + /// + /// Tests the view model non-nullable to view nullable. + /// [Fact] public void ViewModelNonNullableToViewNullable() { @@ -182,6 +203,9 @@ public void ViewModelNonNullableToViewNullable() Assert.Equal(0.0, vm.JustADouble); } + /// + /// Tests the view model nullable to view nullable. + /// [Fact] public void ViewModelNullableToViewNullable() { @@ -201,6 +225,9 @@ public void ViewModelNullableToViewNullable() Assert.Equal(0.0, vm.NullableDouble); } + /// + /// Tests the view model indexer to view. + /// [Fact] public void ViewModelIndexerToView() { @@ -211,6 +238,9 @@ public void ViewModelIndexerToView() Assert.Equal("Foo", view.SomeTextBox.Text); } + /// + /// Tests the view model indexer to view changes. + /// [Fact] public void ViewModelIndexerToViewChanges() { @@ -225,6 +255,9 @@ public void ViewModelIndexerToViewChanges() Assert.Equal("Bar", view.SomeTextBox.Text); } + /// + /// Tests view model indexer property to view. + /// [Fact] public void ViewModelIndexerPropertyToView() { @@ -235,6 +268,9 @@ public void ViewModelIndexerPropertyToView() Assert.Equal("3", view.SomeTextBox.Text); } + /// + /// Tests when OneWayBind shouldn't initially be set to null. + /// [Fact] public void OneWayBindShouldntInitiallySetToNull() { @@ -248,6 +284,9 @@ public void OneWayBindShouldntInitiallySetToNull() Assert.Equal(vm!.Model!.AnotherThing, view.FakeControl.NullHatingString); } + /// + /// Perform a BindTo type conversion smoke test. + /// [Fact] public void BindToTypeConversionSmokeTest() { @@ -263,6 +302,9 @@ public void BindToTypeConversionSmokeTest() Assert.Equal(vm.JustADouble.ToString(CultureInfo.InvariantCulture), view.FakeControl.NullHatingString); } + /// + /// Tests that BindTo null should throw a helpful error. + /// [Fact] public void BindToNullShouldThrowHelpfulError() { @@ -273,6 +315,9 @@ public void BindToNullShouldThrowHelpfulError() .BindTo(view!.ViewModel!, x => x!.Property1)); } + /// + /// Tests that BindTo two-way selected item of ItemControl. + /// [Fact] public void TwoWayBindToSelectedItemOfItemsControl() { @@ -292,6 +337,9 @@ public void TwoWayBindToSelectedItemOfItemsControl() Assert.Equal("bbb", view.FakeItemsControl.SelectedItem); } + /// + /// Tests that ItemControl get a DataTemplate if none is set. + /// [Fact] public void ItemsControlShouldGetADataTemplate() { @@ -304,6 +352,9 @@ public void ItemsControlShouldGetADataTemplate() Assert.NotNull(view.FakeItemsControl.ItemTemplate); } + /// + /// Tests that ItemControl display member path doesn't set a DataTemplate. + /// [Fact] public void ItemsControlWithDisplayMemberPathSetShouldNotGetADataTemplate() { @@ -317,6 +368,9 @@ public void ItemsControlWithDisplayMemberPathSetShouldNotGetADataTemplate() Assert.Null(view.FakeItemsControl.ItemTemplate); } + /// + /// Tests that ItemControl get a DataTemplate if none is set with BindTo. + /// [Fact] public void ItemsControlShouldGetADataTemplateInBindTo() { @@ -333,6 +387,9 @@ public void ItemsControlShouldGetADataTemplateInBindTo() .BindTo(vm, x => x.Property1); } + /// + /// Tests that ItemControl OneWayBind. + /// [Fact] public void BindingToItemsControl() { @@ -345,6 +402,9 @@ public void BindingToItemsControl() Assert.True(itemsSourceValue.OfType().Count() > 1); } + /// + /// Tests OneWayBind and a converter. + /// [Fact] public void OneWayBindConverter() { @@ -355,6 +415,9 @@ public void OneWayBindConverter() Assert.False(view.SomeTextBox.IsEnabled); } + /// + /// Tests OneWayBind and a converter with a null starting value, and tests it against a non-null value. + /// [Fact] public void OneWayBindWithNullStartingValueToNonNullValue() { @@ -368,6 +431,9 @@ public void OneWayBindWithNullStartingValueToNonNullValue() Assert.Equal("Baz", view.SomeTextBox.Text); } + /// + /// Tests OneWayBind and a converter with a non-null starting value, and tests it against a null value. + /// [Fact] public void OneWayBindWithNonNullStartingValueToNullValue() { @@ -383,6 +449,9 @@ public void OneWayBindWithNonNullStartingValueToNullValue() Assert.True(string.IsNullOrEmpty(view.SomeTextBox.Text)); } + /// + /// Tests OneWayBind and a converter with a non-null starting value, and tests it against a non-null value. + /// [Fact] public void OneWayBindWithSelectorAndNonNullStartingValueToNullValue() { @@ -396,6 +465,9 @@ public void OneWayBindWithSelectorAndNonNullStartingValueToNullValue() Assert.True(string.IsNullOrEmpty(view.SomeTextBox.Text)); } + /// + /// Tests OneWayBind initial view model should be garbage collected when overwritten. + /// [Fact] public void OneWayBindInitialViewModelShouldBeGarbageCollectedWhenOverwritten() { @@ -418,6 +490,9 @@ public void OneWayBindInitialViewModelShouldBeGarbageCollectedWhenOverwritten() Assert.False(weakRef.IsAlive); } + /// + /// Tests BindTo with a null starting value, and tests it against a non-null value. + /// [Fact] public void BindToWithNullStartingValueToNonNullValue() { @@ -432,6 +507,9 @@ public void BindToWithNullStartingValueToNonNullValue() Assert.Equal("Baz", view.SomeTextBox.Text); } + /// + /// Tests BindTo with a non-null starting value, and tests it against a null value. + /// [Fact] public void BindToWithNonNullStartingValueToNullValue() { @@ -448,6 +526,9 @@ public void BindToWithNonNullStartingValueToNullValue() Assert.True(string.IsNullOrEmpty(view.SomeTextBox.Text)); } + /// + /// Tests BindTo with a converter is not null. + /// [Fact] public void BindExpectsConverterFuncsToNotBeNull() { @@ -461,6 +542,9 @@ public void BindExpectsConverterFuncsToNotBeNull() Assert.Throws(() => fixture.Bind(vm, view, x => x.Property1, x => x.SomeTextBox.Text, (IObservable?)null, s => s, nullFunc)); } + /// + /// Tests the BindWith func's should work as extension methods. + /// [Fact] public void BindWithFuncShouldWorkAsExtensionMethodSmokeTest() { @@ -470,6 +554,9 @@ public void BindWithFuncShouldWorkAsExtensionMethodSmokeTest() view.Bind(vm, x => x.JustADecimal, x => x.SomeTextBox.Text, d => d.ToString(CultureInfo.InvariantCulture), decimal.Parse); } + /// + /// Tests that bind initial view model should be garbage collected when overwritten. + /// [Fact] public void BindInitialViewModelShouldBeGarbageCollectedWhenOverwritten() { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/RxAppDependencyObjectTests.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/RxAppDependencyObjectTests.cs index 80eb99bce0..11e94e59f1 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/RxAppDependencyObjectTests.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/RxAppDependencyObjectTests.cs @@ -13,8 +13,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Checks RxApp dependency objects. + /// public class RxAppDependencyObjectTests { + /// + /// Tests that Dependency Property notifiers should be found. + /// [Fact] public void DepPropNotifierShouldBeFound() { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/Utilities/DispatcherUtilities.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/Utilities/DispatcherUtilities.cs index 8d27717aad..b24f439dab 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/Utilities/DispatcherUtilities.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/Utilities/DispatcherUtilities.cs @@ -16,8 +16,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Helper utility to handle dispatcher in tests. + /// public static class DispatcherUtilities { + /// + /// Makes the dispatcher perform the events to keep it running. + /// public static void DoEvents() { #if !NETFX_CORE @@ -27,6 +33,11 @@ public static void DoEvents() #endif } + /// + /// Gets the frame to exit. + /// + /// Unused frame object.. + /// Unused return value. [SuppressMessage("Design", "CA1801: Parameter never used", Justification = "Used on some platforms.")] public static object? ExitFrame(object f) { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/WhenAnyThroughDependencyObjectTests.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/WhenAnyThroughDependencyObjectTests.cs index f6166f52e2..71a47fa61d 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/WhenAnyThroughDependencyObjectTests.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/WhenAnyThroughDependencyObjectTests.cs @@ -14,8 +14,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Tests that WhenAny dependency objects. + /// public class WhenAnyThroughDependencyObjectTests { + /// + /// Tests that WhenAny through a view shouldn't give null values. + /// [Fact] public void WhenAnyThroughAViewShouldntGiveNullValues() { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewCommandTests.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewCommandTests.cs index 5d2d9371b1..b2c0ee2519 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewCommandTests.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewCommandTests.cs @@ -25,8 +25,14 @@ namespace ReactiveUI.Tests.Xaml { + /// + /// Tests for XAML and commands. + /// public class XamlViewCommandTests { + /// + /// Test that event binder binds to explicit inherited event. + /// [Fact] public void EventBinderBindsToExplicitInheritedEvent() { @@ -34,6 +40,9 @@ public void EventBinderBindsToExplicitInheritedEvent() fixture.BindCommand(fixture!.ViewModel!, x => x!.Cmd, x => x.TheTextBox, "MouseDown"); } + /// + /// Test that event binder binds to implicit event. + /// [Fact] public void EventBinderBindsToImplicitEvent() { diff --git a/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewDependencyResolverTests.cs b/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewDependencyResolverTests.cs index 3b566ab248..e61f0ae06f 100644 --- a/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewDependencyResolverTests.cs +++ b/src/ReactiveUI.Tests/Platforms/windows-xaml/XamlViewDependencyResolverTests.cs @@ -28,6 +28,9 @@ public sealed class XamlViewDependencyResolverTests : IDisposable { private readonly IDependencyResolver _resolver; + /// + /// Initializes a new instance of the class. + /// public XamlViewDependencyResolverTests() { _resolver = new ModernDependencyResolver(); @@ -36,6 +39,9 @@ public XamlViewDependencyResolverTests() _resolver.RegisterViewsForViewModels(GetType().Assembly); } + /// + /// Test that register views for view model should register all views. + /// [Fact] public void RegisterViewsForViewModelShouldRegisterAllViews() { @@ -48,6 +54,9 @@ public void RegisterViewsForViewModelShouldRegisterAllViews() } } + /// + /// Test that register views for view model should include contracts. + /// [Fact] public void RegisterViewsForViewModelShouldIncludeContracts() { @@ -57,6 +66,7 @@ public void RegisterViewsForViewModelShouldIncludeContracts() } } + /// public void Dispose() => _resolver?.Dispose(); } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/API/WinformsApiApprovalTests.cs b/src/ReactiveUI.Tests/Platforms/winforms/API/WinformsApiApprovalTests.cs index 79f395cf21..d2f04ee989 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/API/WinformsApiApprovalTests.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/API/WinformsApiApprovalTests.cs @@ -9,9 +9,15 @@ namespace ReactiveUI.Tests { + /// + /// Checks the WinForms API to make sure there aren't any unexpected public API changes. + /// [ExcludeFromCodeCoverage] public class WinformsApiApprovalTests : ApiApprovalBase { + /// + /// Checks the approved vs the received API. + /// [Fact] public void Winforms() => CheckApproval(typeof(ReactiveUI.Winforms.WinformsCreatesObservableForProperty).Assembly); } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/ActivationTests.cs b/src/ReactiveUI.Tests/Platforms/winforms/ActivationTests.cs index 59e656015f..4115204e28 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/ActivationTests.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/ActivationTests.cs @@ -10,8 +10,14 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// Tests to make sure the activation works correctly. + /// public class ActivationTests { + /// + /// Tests activations for view fetcher supports default winforms components. + /// [Fact] public void ActivationForViewFetcherSupportsDefaultWinformsComponents() { @@ -24,6 +30,9 @@ public void ActivationForViewFetcherSupportsDefaultWinformsComponents() } } + /// + /// Tests that determines whether this instance [can fetch activator for form]. + /// [Fact] public void CanFetchActivatorForForm() { @@ -34,6 +43,9 @@ public void CanFetchActivatorForForm() Assert.NotNull(formActivator); } + /// + /// Tests that determines whether this instance [can fetch activator for control]. + /// [Fact] public void CanFetchActivatorForControl() { @@ -44,6 +56,9 @@ public void CanFetchActivatorForControl() Assert.NotNull(activator); } + /// + /// Smokes the test windows form. + /// [Fact] public void SmokeTestWindowsForm() { @@ -83,6 +98,9 @@ public void SmokeTestWindowsForm() } } + /// + /// Smokes the test user control. + /// [Fact] public void SmokeTestUserControl() { diff --git a/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingImplementationTests.cs b/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingImplementationTests.cs index 247f0cd6b8..5eb1b3cb30 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingImplementationTests.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingImplementationTests.cs @@ -9,8 +9,14 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// Checks the command bindings. + /// public class CommandBindingImplementationTests { + /// + /// Tests the command bind by name wireup. + /// [Fact] public void CommandBindByNameWireup() { @@ -36,6 +42,9 @@ public void CommandBindByNameWireup() disp.Dispose(); } + /// + /// Tests the command bind explicit event wire up. + /// [Fact] public void CommandBindToExplicitEventWireup() { diff --git a/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingTests.cs b/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingTests.cs index 8286bf23b6..95dd41b940 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingTests.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/CommandBindingTests.cs @@ -12,8 +12,14 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// Command binding tests. + /// public class CommandBindingTests { + /// + /// Tests that the command binder binds to button. + /// [Fact] public void CommandBinderBindsToButton() { @@ -40,6 +46,9 @@ public void CommandBinderBindsToButton() } } + /// + /// Tests that the command binder binds to custom control. + /// [Fact] public void CommandBinderBindsToCustomControl() { @@ -66,6 +75,9 @@ public void CommandBinderBindsToCustomControl() } } + /// + /// Tests that the command binder binds to custom component. + /// [Fact] public void CommandBinderBindsToCustomComponent() { @@ -92,6 +104,9 @@ public void CommandBinderBindsToCustomComponent() } } + /// + /// Tests that the command binder affects enabled. + /// [Fact] public void CommandBinderAffectsEnabledState() { @@ -112,6 +127,9 @@ public void CommandBinderAffectsEnabledState() } } + /// + /// Tests that the command binder affects enabled state for components. + /// [Fact] public void CommandBinderAffectsEnabledStateForComponents() { diff --git a/src/ReactiveUI.Tests/Platforms/winforms/DefaultPropertyBindingTests.cs b/src/ReactiveUI.Tests/Platforms/winforms/DefaultPropertyBindingTests.cs index 10567eb684..b84c4a3339 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/DefaultPropertyBindingTests.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/DefaultPropertyBindingTests.cs @@ -17,8 +17,14 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// Tests default propery binding. + /// public class DefaultPropertyBindingTests { + /// + /// Tests Winforms creates observable for property works for textboxes. + /// [Fact] public void WinformsCreatesObservableForPropertyWorksForTextboxes() { @@ -50,6 +56,9 @@ public void WinformsCreatesObservableForPropertyWorksForTextboxes() Assert.Equal(1, output.Count); } + /// + /// Tests that Winform creates observable for property works for components. + /// [Fact] public void WinformsCreatesObservableForPropertyWorksForComponents() { @@ -81,6 +90,9 @@ public void WinformsCreatesObservableForPropertyWorksForComponents() Assert.Equal(1, output.Count); } + /// + /// Tests that winforms creates observable for property works for third party controls. + /// [Fact] public void WinformsCreatesObservableForPropertyWorksForThirdPartyControls() { @@ -111,6 +123,9 @@ public void WinformsCreatesObservableForPropertyWorksForThirdPartyControls() Assert.Equal(1, output.Count); } + /// + /// Tests that Winforms controled can bind to View Model. + /// [Fact] public void CanBindViewModelToWinformControls() { @@ -133,6 +148,9 @@ public void CanBindViewModelToWinformControls() Assert.Equal(vm.SomeDouble.ToString(CultureInfo.InvariantCulture), view.Property3.Text); } + /// + /// Smoke tests the WinForm controls. + /// [Fact] public void SmokeTestWinformControls() { diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/AnotherView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/AnotherView.cs index 19c1c004fc..6e817cbcc5 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/AnotherView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/AnotherView.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// Another view. + /// public class AnotherView : ReactiveUI.Winforms.ReactiveUserControl { } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ContractExampleView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ContractExampleView.cs index 34e3601b22..32d5b51c6f 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ContractExampleView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ContractExampleView.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A view model that is contracted. + /// [ViewContract("contract")] public class ContractExampleView : ReactiveUI.Winforms.ReactiveUserControl { diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableComponent.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableComponent.cs index b6d718359a..e2527cf010 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableComponent.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableComponent.cs @@ -8,10 +8,19 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A custom clickable component. + /// public class CustomClickableComponent : Component { + /// + /// Occurs when the click. + /// public event EventHandler? Click; + /// + /// Performs the click. + /// public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableControl.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableControl.cs index 2c65e6ece5..39d07c600c 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableControl.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/CustomClickableControl.cs @@ -8,12 +8,26 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// Custom clickable control. + /// public class CustomClickableControl : Control { + /// + /// Performs the click. + /// public void PerformClick() => InvokeOnClick(this, EventArgs.Empty); + /// + /// Raises the mouse click event. + /// + /// The instance containing the event data. public void RaiseMouseClickEvent(MouseEventArgs args) => OnMouseClick(args); + /// + /// Raises the mouse up event. + /// + /// The instance containing the event data. public void RaiseMouseUpEvent(MouseEventArgs args) => OnMouseUp(args); } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ExampleView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ExampleView.cs index 067eb6aabf..7c8fff8c5a 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ExampleView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/ExampleView.cs @@ -11,6 +11,9 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// An example view. + /// public class ExampleView : ReactiveUI.Winforms.ReactiveUserControl { } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeView.cs index 247641feb4..b5ed1953ff 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeView.cs @@ -7,22 +7,33 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A fake view. + /// public class FakeView : IViewFor { + /// + /// Initializes a new instance of the class. + /// public FakeView() { TheTextBox = new TextBox(); ViewModel = new FakeViewModel(); } + /// + /// Gets or sets the text box. + /// public TextBox TheTextBox { get; protected set; } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (FakeViewModel?)value; } + /// public FakeViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeViewModel.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeViewModel.cs index d2b9d7b561..cc3045af3a 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeViewModel.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeViewModel.cs @@ -7,10 +7,19 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A fake view model. + /// public class FakeViewModel : ReactiveObject { + /// + /// Initializes a new instance of the class. + /// public FakeViewModel() => Cmd = ReactiveCommand.Create(() => { }); + /// + /// Gets or sets the command. + /// public ReactiveCommand Cmd { get; protected set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformViewModel.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformViewModel.cs index 8004151bf4..a2549198f8 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformViewModel.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformViewModel.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A fake view model. + /// public class FakeWinformViewModel : ReactiveObject, IRoutableViewModel { private bool _someBooleanProperty; @@ -16,54 +19,87 @@ public class FakeWinformViewModel : ReactiveObject, IRoutableViewModel private string? _property3; private string? _property4; + /// + /// Initializes a new instance of the class. + /// + /// The screen. public FakeWinformViewModel(IScreen? screen = null) => HostScreen = screen ?? new TestScreen(); + /// public string UrlPathSegment => "fake"; + /// public IScreen HostScreen { get; } + /// + /// Gets or sets some integer. + /// public int SomeInteger { get => _someInteger; set => this.RaiseAndSetIfChanged(ref _someInteger, value); } + /// + /// Gets or sets some text. + /// public string? SomeText { get => _someText; set => this.RaiseAndSetIfChanged(ref _someText, value); } + /// + /// Gets or sets some double. + /// public double SomeDouble { get => _someDouble; set => this.RaiseAndSetIfChanged(ref _someDouble, value); } + /// + /// Gets or sets the property1. + /// public string? Property1 { get => _property1; set => this.RaiseAndSetIfChanged(ref _property1, value); } + /// + /// Gets or sets the property2. + /// public string? Property2 { get => _property2; set => this.RaiseAndSetIfChanged(ref _property2, value); } + /// + /// Gets or sets the property3. + /// public string? Property3 { get => _property3; set => this.RaiseAndSetIfChanged(ref _property3, value); } + /// + /// Gets or sets the property4. + /// public string? Property4 { get => _property4; set => this.RaiseAndSetIfChanged(ref _property4, value); } + /// + /// Gets or sets a value indicating whether [boolean property]. + /// + /// + /// true if [boolean property]; otherwise, false. + /// public bool BooleanProperty { get => _someBooleanProperty; diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformsView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformsView.cs index 038ca75d3e..d4a064fd3b 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformsView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformsView.cs @@ -7,8 +7,14 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A fake view model. + /// public class FakeWinformsView : Control, IViewFor { + /// + /// Initializes a new instance of the class. + /// public FakeWinformsView() { Property1 = new Button(); @@ -19,24 +25,44 @@ public FakeWinformsView() SomeDouble = new TextBox(); } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (FakeWinformViewModel?)value; } + /// public FakeWinformViewModel? ViewModel { get; set; } + /// + /// Gets the property1. + /// public Button Property1 { get; } + /// + /// Gets the property2. + /// public Label Property2 { get; } + /// + /// Gets the property3. + /// public TextBox Property3 { get; } + /// + /// Gets the property4. + /// public RichTextBox Property4 { get; } + /// + /// Gets the boolean property. + /// public CheckBox BooleanProperty { get; } + /// + /// Gets some double. + /// public TextBox SomeDouble { get; } } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/NeverUsedView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/NeverUsedView.cs index c218e216b8..1031ad6282 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/NeverUsedView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/NeverUsedView.cs @@ -5,11 +5,20 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A view that is never used. + /// [SingleInstanceView] public class NeverUsedView : ReactiveUI.Winforms.ReactiveUserControl { + /// + /// Initializes a new instance of the class. + /// public NeverUsedView() => Instances++; + /// + /// Gets the instances. + /// public static int Instances { get; private set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/SingleInstanceExampleView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/SingleInstanceExampleView.cs index ecfae6a80f..ba35cc999b 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/SingleInstanceExampleView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/SingleInstanceExampleView.cs @@ -5,11 +5,20 @@ namespace ReactiveUI.Tests.Winforms { + /// + /// A signle instance example view. + /// [SingleInstanceView] public class SingleInstanceExampleView : ReactiveUI.Winforms.ReactiveUserControl { + /// + /// Initializes a new instance of the class. + /// public SingleInstanceExampleView() => Instances++; + /// + /// Gets the instances. + /// public static int Instances { get; private set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/WinformCommandBindView.cs b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/WinformCommandBindView.cs index 44f97a7310..a32ce08647 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/Mocks/WinformCommandBindView.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/Mocks/WinformCommandBindView.cs @@ -15,12 +15,14 @@ public WinformCommandBindView() Command2 = new CustomClickableControl(); } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (WinformCommandBindViewModel?)value; } + /// public WinformCommandBindViewModel? ViewModel { get; set; } public Button Command1 { get; protected set; } diff --git a/src/ReactiveUI.Tests/Platforms/winforms/WinFormsViewDependencyResolverTests.cs b/src/ReactiveUI.Tests/Platforms/winforms/WinFormsViewDependencyResolverTests.cs index a3bb252082..5292157da1 100644 --- a/src/ReactiveUI.Tests/Platforms/winforms/WinFormsViewDependencyResolverTests.cs +++ b/src/ReactiveUI.Tests/Platforms/winforms/WinFormsViewDependencyResolverTests.cs @@ -48,6 +48,7 @@ public void NonContractRegistrationsShouldResolveCorrectly() } } + /// public void Dispose() => _resolver?.Dispose(); [Fact] diff --git a/src/ReactiveUI.Tests/Platforms/wpf/Mocks/CommandBindingView.cs b/src/ReactiveUI.Tests/Platforms/wpf/Mocks/CommandBindingView.cs index dd9133ddcc..ee97750425 100644 --- a/src/ReactiveUI.Tests/Platforms/wpf/Mocks/CommandBindingView.cs +++ b/src/ReactiveUI.Tests/Platforms/wpf/Mocks/CommandBindingView.cs @@ -23,12 +23,14 @@ public CommandBindingView() Command2 = new Image(); } + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (CommandBindingViewModel?)value; } + /// public CommandBindingViewModel? ViewModel { get => _viewModel; diff --git a/src/ReactiveUI.Tests/Platforms/wpf/Mocks/FakeXamlCommandBindingView.cs b/src/ReactiveUI.Tests/Platforms/wpf/Mocks/FakeXamlCommandBindingView.cs index 9963e46eba..b6854eeda9 100644 --- a/src/ReactiveUI.Tests/Platforms/wpf/Mocks/FakeXamlCommandBindingView.cs +++ b/src/ReactiveUI.Tests/Platforms/wpf/Mocks/FakeXamlCommandBindingView.cs @@ -1,14 +1,25 @@ -using System; +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Text; using System.Windows.Controls; namespace ReactiveUI.Tests.Wpf { + /// + /// A fake xaml command binding view. + /// public class FakeXamlCommandBindingView : IViewFor { private readonly Button _buttonDeclaredInXaml; + /// + /// Initializes a new instance of the class. + /// public FakeXamlCommandBindingView() { _buttonDeclaredInXaml = new Button(); @@ -16,14 +27,19 @@ public FakeXamlCommandBindingView() this.BindCommand(ViewModel!, vm => vm!.Command2!, v => v._buttonDeclaredInXaml); } + /// + /// Gets the name of button declared in xaml. + /// public string NameOfButtonDeclaredInXaml => nameof(_buttonDeclaredInXaml); + /// object? IViewFor.ViewModel { get => ViewModel; set => ViewModel = (CommandBindingViewModel?)value; } + /// public CommandBindingViewModel? ViewModel { get; set; } } } diff --git a/src/ReactiveUI.Tests/Platforms/wpf/WpfViewDependencyResolverTests.cs b/src/ReactiveUI.Tests/Platforms/wpf/WpfViewDependencyResolverTests.cs index 769e30d617..b78fd92a81 100644 --- a/src/ReactiveUI.Tests/Platforms/wpf/WpfViewDependencyResolverTests.cs +++ b/src/ReactiveUI.Tests/Platforms/wpf/WpfViewDependencyResolverTests.cs @@ -15,10 +15,17 @@ namespace ReactiveUI.Tests.Wpf { + /// + /// Tests for the WPF View Resolver. + /// + /// public sealed class WpfViewDependencyResolverTests : IDisposable { private readonly IDependencyResolver _resolver; + /// + /// Initializes a new instance of the class. + /// public WpfViewDependencyResolverTests() { _resolver = new ModernDependencyResolver(); @@ -27,6 +34,9 @@ public WpfViewDependencyResolverTests() _resolver.RegisterViewsForViewModels(GetType().Assembly); } + /// + /// Tests that Register views for view model should register all views. + /// [Fact] public void RegisterViewsForViewModelShouldRegisterAllViews() { @@ -36,6 +46,7 @@ public void RegisterViewsForViewModelShouldRegisterAllViews() } } + /// public void Dispose() => _resolver?.Dispose(); } } diff --git a/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphNameOfTestFixture.cs b/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphNameOfTestFixture.cs index d5cbcd48b9..479671cb24 100644 --- a/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphNameOfTestFixture.cs +++ b/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphNameOfTestFixture.cs @@ -8,6 +8,9 @@ namespace ReactiveUI.Tests { + /// + /// A fixture for the OAPH nameof override. + /// public class OaphNameOfTestFixture : TestFixture { [IgnoreDataMember] @@ -16,6 +19,9 @@ public class OaphNameOfTestFixture : TestFixture [IgnoreDataMember] private readonly ObservableAsPropertyHelper _lastThreeLettersOfOneWord; + /// + /// Initializes a new instance of the class. + /// public OaphNameOfTestFixture() { this.WhenAnyValue(x => x.IsOnlyOneWord).Select(x => x ?? string.Empty).Select(x => x.Length >= 3 ? x.Substring(0, 3) : x).ToProperty(this, nameof(FirstThreeLettersOfOneWord), out _firstThreeLettersOfOneWord); @@ -24,9 +30,15 @@ public OaphNameOfTestFixture() #pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type. } + /// + /// Gets the first three letters of one word. + /// [IgnoreDataMember] public string? FirstThreeLettersOfOneWord => _firstThreeLettersOfOneWord.Value; + /// + /// Gets the last three letters of one word. + /// [IgnoreDataMember] public string? LastThreeLettersOfOneWord => _lastThreeLettersOfOneWord.Value; } diff --git a/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphTestFixture.cs b/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphTestFixture.cs index 8153dd3bb6..6262cff693 100644 --- a/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphTestFixture.cs +++ b/src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphTestFixture.cs @@ -8,13 +8,23 @@ namespace ReactiveUI.Tests { + /// + /// Fixtures for the OAPH tests. + /// + /// public class OaphTestFixture : TestFixture { [IgnoreDataMember] private readonly ObservableAsPropertyHelper _firstThreeLettersOfOneWord; + /// + /// Initializes a new instance of the class. + /// public OaphTestFixture() => this.WhenAnyValue(x => x.IsOnlyOneWord).Select(x => x ?? string.Empty).Select(x => x.Length >= 3 ? x.Substring(0, 3) : x).ToProperty(this, x => x.FirstThreeLettersOfOneWord, out _firstThreeLettersOfOneWord); + /// + /// Gets the first three letters of one word. + /// [IgnoreDataMember] public string? FirstThreeLettersOfOneWord => _firstThreeLettersOfOneWord.Value; } diff --git a/src/ReactiveUI.Tests/ReactiveObject/Mocks/TestFixture.cs b/src/ReactiveUI.Tests/ReactiveObject/Mocks/TestFixture.cs index d0d186c4ec..9ac91c3908 100644 --- a/src/ReactiveUI.Tests/ReactiveObject/Mocks/TestFixture.cs +++ b/src/ReactiveUI.Tests/ReactiveObject/Mocks/TestFixture.cs @@ -10,6 +10,10 @@ namespace ReactiveUI.Tests { + /// + /// A test fixture. + /// + /// [DataContract] public class TestFixture : ReactiveObject { @@ -33,8 +37,14 @@ public class TestFixture : ReactiveObject [IgnoreDataMember] private string? _usesExprRaiseSet; + /// + /// Initializes a new instance of the class. + /// public TestFixture() => TestCollection = new ObservableCollectionExtended(); + /// + /// Gets or sets the is not null string. + /// [DataMember] public string? IsNotNullString { @@ -42,6 +52,9 @@ public string? IsNotNullString set => this.RaiseAndSetIfChanged(ref _isNotNullString, value); } + /// + /// Gets or sets the is only one word. + /// [DataMember] public string? IsOnlyOneWord { @@ -49,12 +62,18 @@ public string? IsOnlyOneWord set => this.RaiseAndSetIfChanged(ref _isOnlyOneWord, value); } + /// + /// Gets or sets the not serialized. + /// public string? NotSerialized { get => _notSerialized; set => this.RaiseAndSetIfChanged(ref _notSerialized, value); } + /// + /// Gets or sets the nullable int. + /// [DataMember] public int? NullableInt { @@ -62,6 +81,9 @@ public int? NullableInt set => this.RaiseAndSetIfChanged(ref _nullableInt, value); } + /// + /// Gets or sets the poco property. + /// [DataMember] public string? PocoProperty { @@ -69,6 +91,9 @@ public string? PocoProperty set => _pocoProperty = value; } + /// + /// Gets or sets the stack overflow trigger. + /// [DataMember] public List? StackOverflowTrigger { @@ -76,9 +101,15 @@ public List? StackOverflowTrigger set => this.RaiseAndSetIfChanged(ref _stackOverflowTrigger, value?.ToList()); } + /// + /// Gets or sets the test collection. + /// [DataMember] public ObservableCollectionExtended TestCollection { get; protected set; } + /// + /// Gets or sets the uses expr raise set. + /// [DataMember] public string? UsesExprRaiseSet { diff --git a/src/ReactiveUI.Tests/ReactiveObject/ReactiveObjectTests.cs b/src/ReactiveUI.Tests/ReactiveObject/ReactiveObjectTests.cs index c5e4d5edd0..379888c03a 100644 --- a/src/ReactiveUI.Tests/ReactiveObject/ReactiveObjectTests.cs +++ b/src/ReactiveUI.Tests/ReactiveObject/ReactiveObjectTests.cs @@ -15,8 +15,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests for the reactive object. + /// public class ReactiveObjectTests { + /// + /// Test that changing values should always arrive before changed. + /// [Fact] public void ChangingShouldAlwaysArriveBeforeChanged() { @@ -56,6 +62,9 @@ public void ChangingShouldAlwaysArriveBeforeChanged() Assert.True(afterFired); } + /// + /// Test that deferring the notifications dont show up until undeferred. + /// [Fact] public void DeferredNotificationsDontShowUpUntilUndeferred() { @@ -109,6 +118,9 @@ public void DeferredNotificationsDontShowUpUntilUndeferred() Assert.Equal(expectedEventProperties, propertyChangedEvents.Select(e => e.PropertyName)); } + /// + /// Test that exceptions thrown in subscribers should marshal to thrown exceptions. + /// [Fact] public void ExceptionsThrownInSubscribersShouldMarshalToThrownExceptions() { @@ -124,6 +136,9 @@ public void ExceptionsThrownInSubscribersShouldMarshalToThrownExceptions() Assert.Equal(1, exceptionList.Count); } + /// + /// Tests that ObservableForProperty using expression. + /// [Fact] public void ObservableForPropertyUsingExpression() { @@ -154,6 +169,9 @@ public void ObservableForPropertyUsingExpression() Assert.Equal("Baz", output[1].Value); } + /// + /// Test raises and set using expression. + /// [Fact] public void RaiseAndSetUsingExpression() { @@ -176,6 +194,9 @@ public void RaiseAndSetUsingExpression() Assert.Equal("UsesExprRaiseSet", output[0]); } + /// + /// Test that ReactiveObject shouldn't serialize anything extra. + /// [Fact] public void ReactiveObjectShouldntSerializeAnythingExtra() { @@ -198,6 +219,9 @@ public void ReactiveObjectShouldntSerializeAnythingExtra() Assert.True(json.Count(x => x == '"') == 18); } + /// + /// Performs a ReactiveObject smoke test. + /// [Fact] public void ReactiveObjectSmokeTest() { @@ -228,6 +252,9 @@ public void ReactiveObjectSmokeTest() results.AssertAreEqual(output); } + /// + /// Tests to make sure that ReactiveObject doesn't rethrow exceptions. + /// [Fact] public void ReactiveObjectShouldRethrowException() { diff --git a/src/ReactiveUI.Tests/ReactiveUI.Tests.csproj b/src/ReactiveUI.Tests/ReactiveUI.Tests.csproj index a576a12259..9d84c83074 100644 --- a/src/ReactiveUI.Tests/ReactiveUI.Tests.csproj +++ b/src/ReactiveUI.Tests/ReactiveUI.Tests.csproj @@ -1,17 +1,18 @@  - + netcoreapp3.1 $(TargetFrameworks);net472;net5.0-windows10.0.19041 enable latest + $(NoWarn);CS1591 - + @@ -26,17 +27,17 @@ - true - true + true + true - - - - - - - + + + + + + + diff --git a/src/ReactiveUI.Tests/Routing/Mocks/TestScreen.cs b/src/ReactiveUI.Tests/Routing/Mocks/TestScreen.cs index 53f0b9c924..197fbb7755 100644 --- a/src/ReactiveUI.Tests/Routing/Mocks/TestScreen.cs +++ b/src/ReactiveUI.Tests/Routing/Mocks/TestScreen.cs @@ -15,6 +15,7 @@ public class TestScreen : ReactiveObject, IScreen { private RoutingState? _router; + /// public RoutingState? Router { #pragma warning disable CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes). diff --git a/src/ReactiveUI.Tests/Routing/Mocks/TestViewModel.cs b/src/ReactiveUI.Tests/Routing/Mocks/TestViewModel.cs index 31e6ce2e11..5da595d12b 100644 --- a/src/ReactiveUI.Tests/Routing/Mocks/TestViewModel.cs +++ b/src/ReactiveUI.Tests/Routing/Mocks/TestViewModel.cs @@ -21,8 +21,10 @@ public string? SomeProp set => this.RaiseAndSetIfChanged(ref _someProp, value); } + /// public string UrlPathSegment => "Test"; + /// public IScreen HostScreen { get; } = new TestScreen(); } } diff --git a/src/ReactiveUI.Tests/RxAppTest.cs b/src/ReactiveUI.Tests/RxAppTest.cs index 358326ddc5..e87448464d 100644 --- a/src/ReactiveUI.Tests/RxAppTest.cs +++ b/src/ReactiveUI.Tests/RxAppTest.cs @@ -11,8 +11,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests the RxApp class. + /// public class RxAppTest { + /// + /// Tests that schedulers should be current thread in test runner. + /// [Fact] public void SchedulerShouldBeCurrentThreadInTestRunner() { diff --git a/src/ReactiveUI.Tests/Utilities/CountingTestScheduler.cs b/src/ReactiveUI.Tests/Utilities/CountingTestScheduler.cs index 05f0f713a0..83c09d9a52 100644 --- a/src/ReactiveUI.Tests/Utilities/CountingTestScheduler.cs +++ b/src/ReactiveUI.Tests/Utilities/CountingTestScheduler.cs @@ -24,20 +24,24 @@ public CountingTestScheduler(IScheduler innerScheduler) public List<(Action action, TimeSpan? dueTime)> ScheduledItems { get; } + /// public DateTimeOffset Now => InnerScheduler.Now; + /// public IDisposable Schedule(TState state, DateTimeOffset dueTime, Func action) { ScheduledItems.Add((() => action(this, state), null)); return InnerScheduler.Schedule(state, dueTime, action); } + /// public IDisposable Schedule(TState state, TimeSpan dueTime, Func action) { ScheduledItems.Add((() => action(this, state), dueTime)); return InnerScheduler.Schedule(state, dueTime, action); } + /// public IDisposable Schedule(TState state, Func action) { ScheduledItems.Add((() => action(this, state), null)); diff --git a/src/ReactiveUI.Tests/Utilities/TestLogger.cs b/src/ReactiveUI.Tests/Utilities/TestLogger.cs index b0284a314c..6f83e5f5dd 100644 --- a/src/ReactiveUI.Tests/Utilities/TestLogger.cs +++ b/src/ReactiveUI.Tests/Utilities/TestLogger.cs @@ -23,14 +23,19 @@ public TestLogger() public List<(string message, Type type, LogLevel logLevel)> Messages { get; } + /// public LogLevel Level { get; set; } + /// public void Write(Exception exception, string message, Type type, LogLevel logLevel) => Messages.Add((message, typeof(TestLogger), logLevel)); + /// public void Write(string message, LogLevel logLevel) => Messages.Add((message, typeof(TestLogger), logLevel)); + /// public void Write(Exception exception, string message, LogLevel logLevel) => Messages.Add((message, typeof(TestLogger), logLevel)); + /// public void Write([Localizable(false)] string message, [Localizable(false)] Type type, LogLevel logLevel) => Messages.Add((message, type, logLevel)); } } diff --git a/src/ReactiveUI.Tests/Utilities/UseInvariantCulture.cs b/src/ReactiveUI.Tests/Utilities/UseInvariantCulture.cs index 62096812ae..fe6c8c612a 100644 --- a/src/ReactiveUI.Tests/Utilities/UseInvariantCulture.cs +++ b/src/ReactiveUI.Tests/Utilities/UseInvariantCulture.cs @@ -21,12 +21,14 @@ public class UseInvariantCulture : BeforeAfterTestAttribute { private CultureInfo? _storedCulture; + /// public override void Before(MethodInfo methodUnderTest) { _storedCulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; } + /// public override void After(MethodInfo methodUnderTest) { if (_storedCulture is not null) diff --git a/src/ReactiveUI.Tests/WaitForDispatcherSchedulerTests.cs b/src/ReactiveUI.Tests/WaitForDispatcherSchedulerTests.cs index 577ff1b142..05940e9109 100644 --- a/src/ReactiveUI.Tests/WaitForDispatcherSchedulerTests.cs +++ b/src/ReactiveUI.Tests/WaitForDispatcherSchedulerTests.cs @@ -11,8 +11,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests the WaitForDispatcherSchedulerClass. + /// public class WaitForDispatcherSchedulerTests { + /// + /// Tests call scheduler factory on creation. + /// [Fact] public void CallSchedulerFactoryOnCreation() { @@ -29,6 +35,9 @@ public void CallSchedulerFactoryOnCreation() Assert.Equal(1, schedulerFactoryCalls); } + /// + /// Calls that factories throws argument null exception falls back to current thread. + /// [Fact] public void FactoryThrowsArgumentNullException_FallsBackToCurrentThread() { @@ -49,6 +58,9 @@ public void FactoryThrowsArgumentNullException_FallsBackToCurrentThread() Assert.Equal(CurrentThreadScheduler.Instance, schedulerExecutedOn); } + /// + /// Tests that factories throws exception re calls on schedule. + /// [Fact] public void FactoryThrowsException_ReCallsOnSchedule() { @@ -66,6 +78,9 @@ public void FactoryThrowsException_ReCallsOnSchedule() Assert.Equal(2, schedulerFactoryCalls); } + /// + /// Tests that factories throws invalid operation exception falls back to current thread. + /// [Fact] public void FactoryThrowsInvalidOperationException_FallsBackToCurrentThread() { @@ -84,6 +99,9 @@ public void FactoryThrowsInvalidOperationException_FallsBackToCurrentThread() Assert.Equal(CurrentThreadScheduler.Instance, schedulerExecutedOn); } + /// + /// Tests that factory uses cached scheduler. + /// [Fact] public void SuccessfulFactory_UsesCachedScheduler() { diff --git a/src/ReactiveUI.Tests/WhenAny/Mockups/HostTestFixture.cs b/src/ReactiveUI.Tests/WhenAny/Mockups/HostTestFixture.cs index 4f2574bcda..4ca394fd54 100644 --- a/src/ReactiveUI.Tests/WhenAny/Mockups/HostTestFixture.cs +++ b/src/ReactiveUI.Tests/WhenAny/Mockups/HostTestFixture.cs @@ -5,6 +5,9 @@ namespace ReactiveUI.Tests { + /// + /// A host test fixture. + /// public class HostTestFixture : ReactiveObject { private TestFixture? _Child; @@ -13,18 +16,27 @@ public class HostTestFixture : ReactiveObject private int _SomeOtherParam; + /// + /// Gets or sets the child. + /// public TestFixture? Child { get => _Child; set => this.RaiseAndSetIfChanged(ref _Child, value); } + /// + /// Gets or sets the poco child. + /// public NonObservableTestFixture? PocoChild { get => _PocoChild; set => this.RaiseAndSetIfChanged(ref _PocoChild, value); } + /// + /// Gets or sets some other parameter. + /// public int SomeOtherParam { get => _SomeOtherParam; diff --git a/src/ReactiveUI.Tests/WhenAny/Mockups/NonReactiveINPCObject.cs b/src/ReactiveUI.Tests/WhenAny/Mockups/NonReactiveINPCObject.cs index 40213e0a6d..e3924ef3f7 100644 --- a/src/ReactiveUI.Tests/WhenAny/Mockups/NonReactiveINPCObject.cs +++ b/src/ReactiveUI.Tests/WhenAny/Mockups/NonReactiveINPCObject.cs @@ -11,6 +11,7 @@ public class NonReactiveINPCObject : INotifyPropertyChanged { private TestFixture _inpcProperty = new(); + /// public event PropertyChangedEventHandler? PropertyChanged; public TestFixture InpcProperty diff --git a/src/ReactiveUI.Tests/WhenAny/ReactiveNotifyPropertyChangedMixinTest.cs b/src/ReactiveUI.Tests/WhenAny/ReactiveNotifyPropertyChangedMixinTest.cs index 0f4f1234bd..3723b2c6c1 100644 --- a/src/ReactiveUI.Tests/WhenAny/ReactiveNotifyPropertyChangedMixinTest.cs +++ b/src/ReactiveUI.Tests/WhenAny/ReactiveNotifyPropertyChangedMixinTest.cs @@ -22,8 +22,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests the reactive notify property changed. + /// public class ReactiveNotifyPropertyChangedMixinTest { + /// + /// Gets or sets the dummy. + /// public string? Dummy { get; set; } [Fact] diff --git a/src/ReactiveUI.Tests/WhenAny/WhenAnyObservableTests.cs b/src/ReactiveUI.Tests/WhenAny/WhenAnyObservableTests.cs index c09416d73b..7d34626ce0 100644 --- a/src/ReactiveUI.Tests/WhenAny/WhenAnyObservableTests.cs +++ b/src/ReactiveUI.Tests/WhenAny/WhenAnyObservableTests.cs @@ -16,8 +16,14 @@ namespace ReactiveUI.Tests { + /// + /// Tests WhenAnyObservable. + /// public class WhenAnyObservableTests { + /// + /// Tests that null observables do not cause exceptions. + /// [Fact] public void NullObservablesDoNotCauseExceptions() { @@ -52,6 +58,10 @@ public void NullObservablesDoNotCauseExceptions() #pragma warning restore CS8603 // Possible null reference return. } + /// + /// Performs a smoke test on combining WhenAnyObservable. + /// + /// A task to monitor the progress. [Fact] public async Task WhenAnyObservableSmokeTestCombining() { @@ -84,6 +94,10 @@ public async Task WhenAnyObservableSmokeTestCombining() }).All(x => x.expected == x.actual)); } + /// + /// Performs a smoke test testing WhenAnyObservable merging results. + /// + /// A task to monitor the progress. [Fact] public async Task WhenAnyObservableSmokeTestMerging() { @@ -115,6 +129,9 @@ public async Task WhenAnyObservableSmokeTestMerging() }).All(x => x.expected == x.actual)); } + /// + /// Tests WhenAnyObservable with null object should update when object isnt null anymore. + /// [Fact] public void WhenAnyObservableWithNullObjectShouldUpdateWhenObjectIsntNullAnymore() { diff --git a/src/ReactiveUI.XamForms.Tests/Mocks/ChildView.cs b/src/ReactiveUI.XamForms.Tests/Mocks/ChildView.cs index a143c8ccf2..840535d6c5 100644 --- a/src/ReactiveUI.XamForms.Tests/Mocks/ChildView.cs +++ b/src/ReactiveUI.XamForms.Tests/Mocks/ChildView.cs @@ -1,5 +1,13 @@ -namespace ReactiveUI.XamForms.Tests.Mocks +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace ReactiveUI.XamForms.Tests.Mocks { + /// + /// The child view. + /// public class ChildView : ReactiveContentPage { } diff --git a/src/ReactiveUI.XamForms.Tests/Mocks/ChildViewModel.cs b/src/ReactiveUI.XamForms.Tests/Mocks/ChildViewModel.cs index d7a974d589..5c7c088c53 100644 --- a/src/ReactiveUI.XamForms.Tests/Mocks/ChildViewModel.cs +++ b/src/ReactiveUI.XamForms.Tests/Mocks/ChildViewModel.cs @@ -1,19 +1,39 @@ -using Splat; +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using Splat; namespace ReactiveUI.XamForms.Tests.Mocks { + /// + /// The child view model. + /// public class ChildViewModel : ReactiveObject, IRoutableViewModel { + /// + /// Initializes a new instance of the class. + /// public ChildViewModel() => HostScreen = Locator.Current.GetService(); + /// + /// Initializes a new instance of the class. + /// + /// The value. public ChildViewModel(string value) : this() => Value = value; + /// public string? UrlPathSegment => "Child view: " + Value; + /// public IScreen HostScreen { get; } + /// + /// Gets the value. + /// public string Value { get; } = string.Empty; } } diff --git a/src/ReactiveUI.XamForms.Tests/Mocks/MainView.cs b/src/ReactiveUI.XamForms.Tests/Mocks/MainView.cs index 6e33ef096c..1226318a60 100644 --- a/src/ReactiveUI.XamForms.Tests/Mocks/MainView.cs +++ b/src/ReactiveUI.XamForms.Tests/Mocks/MainView.cs @@ -1,5 +1,13 @@ -namespace ReactiveUI.XamForms.Tests.Mocks +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace ReactiveUI.XamForms.Tests.Mocks { + /// + /// The main view. + /// public class MainView : ReactiveContentPage { } diff --git a/src/ReactiveUI.XamForms.Tests/Mocks/MainViewModel.cs b/src/ReactiveUI.XamForms.Tests/Mocks/MainViewModel.cs index eebc51517c..aebc329acf 100644 --- a/src/ReactiveUI.XamForms.Tests/Mocks/MainViewModel.cs +++ b/src/ReactiveUI.XamForms.Tests/Mocks/MainViewModel.cs @@ -1,13 +1,26 @@ -using Splat; +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using Splat; namespace ReactiveUI.XamForms.Tests.Mocks { + /// + /// The main view model. + /// public class MainViewModel : ReactiveObject, IRoutableViewModel { + /// + /// Initializes a new instance of the class. + /// public MainViewModel() => HostScreen = Locator.Current.GetService(); + /// public string? UrlPathSegment => "Main view"; + /// public IScreen HostScreen { get; } } } diff --git a/src/ReactiveUI.XamForms.Tests/Mocks/NavigationViewModel.cs b/src/ReactiveUI.XamForms.Tests/Mocks/NavigationViewModel.cs index 1dd61280f0..f47912ac27 100644 --- a/src/ReactiveUI.XamForms.Tests/Mocks/NavigationViewModel.cs +++ b/src/ReactiveUI.XamForms.Tests/Mocks/NavigationViewModel.cs @@ -1,31 +1,59 @@ -using System; +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using System; using System.Reactive; using Splat; namespace ReactiveUI.XamForms.Tests.Mocks { + /// + /// The navigation view model. + /// public class NavigationViewModel : ReactiveObject, IScreen { + /// public RoutingState Router { get; } = new(); + /// + /// Navigates the specified name. + /// + /// The name. + /// An observable with the view model. public IObservable Navigate(string name) { var viewModel = Locator.Current.GetService(name); return Router.Navigate.Execute(viewModel); } + /// + /// Navigates to child. + /// + /// The value. + /// An observable with the view model. public IObservable NavigateToChild(string value) { var viewModel = new ChildViewModel(value); return Router.Navigate.Execute(viewModel); } + /// + /// Navigates and reset to child. + /// + /// The value. + /// An observable with the view model. public IObservable NavigateAndResetToChild(string value) { var viewModel = new ChildViewModel(value); return Router.NavigateAndReset.Execute(viewModel); } + /// + /// Navigates back. + /// + /// An observable. public IObservable NavigateBack() => Router.NavigateBack.Execute(); } } diff --git a/src/ReactiveUI.XamForms.Tests/RoutedViewHostTest.cs b/src/ReactiveUI.XamForms.Tests/RoutedViewHostTest.cs index ec195742c0..3831737697 100644 --- a/src/ReactiveUI.XamForms.Tests/RoutedViewHostTest.cs +++ b/src/ReactiveUI.XamForms.Tests/RoutedViewHostTest.cs @@ -1,4 +1,9 @@ -using System; +// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using System; using System.Reactive.Linq; using System.Threading.Tasks; using ReactiveUI.XamForms.Tests.Mocks; @@ -7,10 +12,17 @@ namespace ReactiveUI.XamForms.Tests { + /// + /// Tests the RoutedView hosting. + /// + /// public sealed class RoutedViewHostTest : IDisposable { private readonly NavigationViewModel _navigationViewModel = new(); + /// + /// Initializes a new instance of the class. + /// public RoutedViewHostTest() { Locator.CurrentMutable.Register>(() => new MainView()); @@ -21,6 +33,9 @@ public RoutedViewHostTest() Locator.CurrentMutable.Register(() => new ChildViewModel(), nameof(ChildViewModel)); } + /// + /// Tests that creating a new RoutedView without a view model that it has no current page. + /// [Fact] public void NewRoutedViewHostHasNoCurrentPage() { @@ -30,6 +45,9 @@ public void NewRoutedViewHostHasNoCurrentPage() Assert.Equal(0, fixture.StackDepth); } + /// + /// Tests that creating a new RoutedView with a view model that it has the main view as the current page. + /// [Fact] public void NewRoutedViewHostHasMainViewCurrentPage() { @@ -45,6 +63,10 @@ public void NewRoutedViewHostHasMainViewCurrentPage() Assert.Equal(1, fixture.StackDepth); } + /// + /// Tests that creating a new RoutedView can navigate to a page from a initial no page. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateToMainViewFromNoPage() { @@ -64,6 +86,10 @@ public async Task NavigateToMainViewFromNoPage() Assert.Equal(1, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate to child views. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateToChildView() { @@ -83,6 +109,10 @@ public async Task NavigateToChildView() Assert.Equal(2, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate to second child view. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateToSecondChildView() { @@ -103,6 +133,10 @@ public async Task NavigateToSecondChildView() Assert.Equal(3, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate back from child view. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateBackFromChildView() { @@ -122,6 +156,10 @@ public async Task NavigateBackFromChildView() Assert.Equal(1, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate back from second child view. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateBackFromSecondChildView() { @@ -143,6 +181,10 @@ public async Task NavigateBackFromSecondChildView() Assert.Equal(2, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate back twice from a child view. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateBackFromChildView2Times() { @@ -164,6 +206,10 @@ public async Task NavigateBackFromChildView2Times() Assert.Equal(1, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate back twice from the main view. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateBackFromMainView() { @@ -182,6 +228,10 @@ public async Task NavigateBackFromMainView() Assert.Equal(1, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate back from the main view then to the child view. + /// + /// A task to monitor the progress. [Fact] public async Task NavigateBackFromMainViewAndThenToChildView() { @@ -202,6 +252,11 @@ public async Task NavigateBackFromMainViewAndThenToChildView() Assert.Equal(1, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate to a child view then reset. + /// + /// The stack depth before the reset. + /// A task to monitor the progress. [Theory] [InlineData(0)] [InlineData(1)] @@ -229,6 +284,12 @@ public async Task NavigateToChildViewAndReset(int stackDepthBefore) Assert.Equal(1, fixture.StackDepth); } + /// + /// Test that makes sure that you can navigate back from a child view. + /// + /// If we should navigated animated. + /// If we should navigate fast. + /// A task to monitor the progress. [Theory] [InlineData(false, false)] [InlineData(false, true)] @@ -255,6 +316,12 @@ public async Task GoBackFromChildView(bool animated, bool fast) Assert.Equal("Main view", currentPage.Title); } + /// + /// Test that makes sure that you can navigate back from a second child view. + /// + /// If we should navigated animated. + /// If we should navigate fast. + /// A task to monitor the progress. [Theory] [InlineData(false, false)] [InlineData(false, true)] @@ -283,6 +350,9 @@ public async Task GoBackFromSecondChildView(bool animated, bool fast) Assert.Equal("Child view: C1", currentPage.Title); } + /// + /// Releases unmanaged and - optionally - managed resources. + /// public void Dispose() => Locator.SetLocator(new ModernDependencyResolver()); private RoutedViewHost CreateRoutedViewHost(string? initialViewModel = nameof(MainViewModel)) diff --git a/src/ReactiveUI.sln b/src/ReactiveUI.sln index d2b8865c54..0762ed0ad2 100644 --- a/src/ReactiveUI.sln +++ b/src/ReactiveUI.sln @@ -6,8 +6,6 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BD9762CF-E104-481C-96A6-26E624B86283}" ProjectSection(SolutionItems) = preProject ..\.editorconfig = ..\.editorconfig - analyzers.ruleset = analyzers.ruleset - analyzers.tests.ruleset = analyzers.tests.ruleset Directory.build.props = Directory.build.props Directory.build.targets = Directory.build.targets global.json = global.json diff --git a/src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewSource.cs b/src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewSource.cs index 985a8a869b..4b73aeef61 100644 --- a/src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewSource.cs +++ b/src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewSource.cs @@ -40,10 +40,13 @@ public ReactiveTableViewSource(UITableView tableView, INotifyCollectionChanged c : this(tableView) => Data = new[] { new TableSectionInformation(collection, cellKey, sizeHint, initializeCellAction) }; + /// + /// Initializes a new instance of the class. + /// + /// The table view. + /// A read only list of table section information. [Obsolete("Please bind your view model to the Data property.")] -#pragma warning disable SA1600 // Elements should be documented public ReactiveTableViewSource(UITableView tableView, IReadOnlyList> sectionInformation) -#pragma warning restore SA1600 // Elements should be documented : this(tableView) { Data = sectionInformation; diff --git a/src/ReactiveUI/ReactiveUI.csproj b/src/ReactiveUI/ReactiveUI.csproj index 7983e0721f..4e92f90076 100644 --- a/src/ReactiveUI/ReactiveUI.csproj +++ b/src/ReactiveUI/ReactiveUI.csproj @@ -117,7 +117,7 @@ - + diff --git a/src/ReactiveUI/VariadicTemplates.cs b/src/ReactiveUI/VariadicTemplates.cs index b7ebe5f209..c5ee2ec4d7 100644 --- a/src/ReactiveUI/VariadicTemplates.cs +++ b/src/ReactiveUI/VariadicTemplates.cs @@ -12,14 +12,9 @@ //------------------------------------------------------------------------------ using System; -using System.Collections.Generic; -using System.Reactive.Disposables; using System.Reactive.Linq; -using System.Diagnostics.Contracts; using System.Linq; using System.Linq.Expressions; -using System.Reflection; -using System.Text; namespace ReactiveUI @@ -34,10 +29,16 @@ public static class WhenAnyMixin /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The first property chain to reference. This will be a expression pointing to a end property or field. public static IObservable WhenAnyValue( - this TSender source, - Expression> property1) => - source.WhenAny(property1, (IObservedChange c1) => c1.Value); + this TSender sender, + Expression> property1) + { + return sender.WhenAny(property1, (IObservedChange c1) => c1.Value); + } + + /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -46,12 +47,18 @@ public static IObservable WhenAnyValue( /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Func selector) => - This.WhenAny(property1, - (c1) => - selector(c1.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Func selector) + { + return sender.WhenAny(property1, + (c1) => + selector(c1.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -60,10 +67,17 @@ public static IObservable WhenAnyValue(this TSender Thi /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, - Func, TRet> selector) => - This.ObservableForProperty(property1, false, false).Select(selector); + Func, TRet> selector) + { + return sender.ObservableForProperty(property1, false, false).Select(selector); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -72,11 +86,17 @@ public static IObservable WhenAny(this TSender This, /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, - Func, TRet> selector) => - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false).Select(selector); + Func, TRet> selector) + { + return ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false).Select(selector); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -85,14 +105,19 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. public static IObservable<(T1, T2)> WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1, Expression> property2 - ) => - This.WhenAny(property1, property2, - (c1, c2) => - (c1.Value, c2.Value)); + ) + { + return sender.WhenAny(property1, property2, + (c1, c2) => + (c1.Value, c2.Value)); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -101,13 +126,20 @@ Expression> property2 /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Func selector) => - This.WhenAny(property1, property2, - (c1, c2) => - selector(c1.Value, c2.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Func selector) + { + return sender.WhenAny(property1, property2, + (c1, c2) => + selector(c1.Value, c2.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -116,15 +148,23 @@ public static IObservable WhenAnyValue(this TSender /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, - Func, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - selector - ); + Func, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -133,17 +173,24 @@ public static IObservable WhenAny(this TSender This /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, - Func, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - selector - ); + Func, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + selector +); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -152,15 +199,21 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. public static IObservable<(T1, T2, T3)> WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1, Expression> property2, Expression> property3 - ) => - This.WhenAny(property1, property2, property3, - (c1, c2, c3) => - (c1.Value, c2.Value, c3.Value)); + ) + { + return sender.WhenAny(property1, property2, property3, + (c1, c2, c3) => + (c1.Value, c2.Value, c3.Value)); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -169,14 +222,22 @@ Expression> property3 /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Func selector) => - This.WhenAny(property1, property2, property3, - (c1, c2, c3) => - selector(c1.Value, c2.Value, c3.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Func selector) + { + return sender.WhenAny(property1, property2, property3, + (c1, c2, c3) => + selector(c1.Value, c2.Value, c3.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -185,17 +246,26 @@ public static IObservable WhenAnyValue(this TSe /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, - Func, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - selector - ); + Func, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -204,20 +274,28 @@ public static IObservable WhenAny(this TSender /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, - Func, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - selector - ); + Func, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + selector +); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -226,16 +304,23 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. public static IObservable<(T1, T2, T3, T4)> WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1, Expression> property2, Expression> property3, Expression> property4 - ) => - This.WhenAny(property1, property2, property3, property4, - (c1, c2, c3, c4) => - (c1.Value, c2.Value, c3.Value, c4.Value)); + ) + { + return sender.WhenAny(property1, property2, property3, property4, + (c1, c2, c3, c4) => + (c1.Value, c2.Value, c3.Value, c4.Value)); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -244,15 +329,24 @@ Expression> property4 /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Func selector) => - This.WhenAny(property1, property2, property3, property4, - (c1, c2, c3, c4) => - selector(c1.Value, c2.Value, c3.Value, c4.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, + (c1, c2, c3, c4) => + selector(c1.Value, c2.Value, c3.Value, c4.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -261,19 +355,29 @@ public static IObservable WhenAnyValue(this /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, Expression> property4, - Func, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -282,23 +386,32 @@ public static IObservable WhenAny(this TSen /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, Expression property4, - Func, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + selector +); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -307,17 +420,25 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. public static IObservable<(T1, T2, T3, T4, T5)> WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1, Expression> property2, Expression> property3, Expression> property4, Expression> property5 - ) => - This.WhenAny(property1, property2, property3, property4, property5, - (c1, c2, c3, c4, c5) => - (c1.Value, c2.Value, c3.Value, c4.Value, c5.Value)); + ) + { + return sender.WhenAny(property1, property2, property3, property4, property5, + (c1, c2, c3, c4, c5) => + (c1.Value, c2.Value, c3.Value, c4.Value, c5.Value)); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -326,16 +447,26 @@ Expression> property5 /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, - (c1, c2, c3, c4, c5) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, + (c1, c2, c3, c4, c5) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -344,21 +475,32 @@ public static IObservable WhenAnyValue( /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, Expression> property4, Expression> property5, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -367,26 +509,36 @@ public static IObservable WhenAny(this /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, Expression property4, Expression property5, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + selector +); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -395,18 +547,27 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. public static IObservable<(T1, T2, T3, T4, T5, T6)> WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1, Expression> property2, Expression> property3, Expression> property4, Expression> property5, Expression> property6 - ) => - This.WhenAny(property1, property2, property3, property4, property5, property6, - (c1, c2, c3, c4, c5, c6) => - (c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value)); + ) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, + (c1, c2, c3, c4, c5, c6) => + (c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value)); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -415,17 +576,28 @@ Expression> property6 /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, - (c1, c2, c3, c4, c5, c6) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, + (c1, c2, c3, c4, c5, c6) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -434,23 +606,35 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, Expression> property4, Expression> property5, Expression> property6, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -459,29 +643,40 @@ public static IObservable WhenAny(t /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, Expression property4, Expression property5, Expression property6, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + selector +); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -490,8 +685,16 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. public static IObservable<(T1, T2, T3, T4, T5, T6, T7)> WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -499,10 +702,12 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression> property5, Expression> property6, Expression> property7 - ) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, - (c1, c2, c3, c4, c5, c6, c7) => - (c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value)); + ) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, + (c1, c2, c3, c4, c5, c6, c7) => + (c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value)); + } /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -511,18 +716,30 @@ Expression> property7 /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Expression> property7, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, - (c1, c2, c3, c4, c5, c6, c7) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Expression> property7, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, + (c1, c2, c3, c4, c5, c6, c7) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -531,7 +748,17 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -539,17 +766,20 @@ public static IObservable WhenAny> property5, Expression> property6, Expression> property7, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - This.ObservableForProperty(property7, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + sender.ObservableForProperty(property7, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -558,7 +788,17 @@ public static IObservable WhenAny - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, @@ -566,24 +806,27 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression property5, Expression property6, Expression property7, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property7, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property7, false, false), + selector +); + } + /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -592,19 +835,32 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Expression> property7, - Expression> property8, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, - (c1, c2, c3, c4, c5, c6, c7, c8) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Expression> property7, + Expression> property8, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, + (c1, c2, c3, c4, c5, c6, c7, c8) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -613,7 +869,18 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -622,18 +889,21 @@ public static IObservable WhenAny> property6, Expression> property7, Expression> property8, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - This.ObservableForProperty(property7, false, false), - This.ObservableForProperty(property8, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + sender.ObservableForProperty(property7, false, false), + sender.ObservableForProperty(property8, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -642,7 +912,18 @@ public static IObservable WhenAny - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, @@ -651,26 +932,29 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression property6, Expression property7, Expression property8, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property7, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property8, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property7, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property8, false, false), + selector +); + } + /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -679,20 +963,34 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Expression> property7, - Expression> property8, - Expression> property9, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, - (c1, c2, c3, c4, c5, c6, c7, c8, c9) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Expression> property7, + Expression> property8, + Expression> property9, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, + (c1, c2, c3, c4, c5, c6, c7, c8, c9) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -701,7 +999,19 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -711,19 +1021,22 @@ public static IObservable WhenAny> property7, Expression> property8, Expression> property9, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - This.ObservableForProperty(property7, false, false), - This.ObservableForProperty(property8, false, false), - This.ObservableForProperty(property9, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + sender.ObservableForProperty(property7, false, false), + sender.ObservableForProperty(property8, false, false), + sender.ObservableForProperty(property9, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -732,7 +1045,19 @@ public static IObservable WhenAny - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, @@ -742,28 +1067,31 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression property7, Expression property8, Expression property9, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property7, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property8, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property9, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property7, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property8, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property9, false, false), + selector +); + } + /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -772,21 +1100,36 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Expression> property7, - Expression> property8, - Expression> property9, - Expression> property10, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, property10, - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Expression> property7, + Expression> property8, + Expression> property9, + Expression> property10, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, property10, + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -795,7 +1138,20 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -806,20 +1162,23 @@ public static IObservable WhenAny> property8, Expression> property9, Expression> property10, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - This.ObservableForProperty(property7, false, false), - This.ObservableForProperty(property8, false, false), - This.ObservableForProperty(property9, false, false), - This.ObservableForProperty(property10, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + sender.ObservableForProperty(property7, false, false), + sender.ObservableForProperty(property8, false, false), + sender.ObservableForProperty(property9, false, false), + sender.ObservableForProperty(property10, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -828,7 +1187,20 @@ public static IObservable WhenAny - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, @@ -839,30 +1211,33 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression property8, Expression property9, Expression property10, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property7, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property8, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property9, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property10, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property7, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property8, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property9, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property10, false, false), + selector +); + } + /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -871,22 +1246,38 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Expression> property7, - Expression> property8, - Expression> property9, - Expression> property10, - Expression> property11, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, property10, property11, - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value, c11.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The 11 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Expression> property7, + Expression> property8, + Expression> property9, + Expression> property10, + Expression> property11, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, property10, property11, + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value, c11.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -895,7 +1286,21 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The 11 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -907,21 +1312,24 @@ public static IObservable WhenAny> property9, Expression> property10, Expression> property11, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - This.ObservableForProperty(property7, false, false), - This.ObservableForProperty(property8, false, false), - This.ObservableForProperty(property9, false, false), - This.ObservableForProperty(property10, false, false), - This.ObservableForProperty(property11, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + sender.ObservableForProperty(property7, false, false), + sender.ObservableForProperty(property8, false, false), + sender.ObservableForProperty(property9, false, false), + sender.ObservableForProperty(property10, false, false), + sender.ObservableForProperty(property11, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -930,7 +1338,21 @@ public static IObservable WhenAny - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The 11 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, @@ -942,32 +1364,35 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression property9, Expression property10, Expression property11, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property7, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property8, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property9, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property10, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property11, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property7, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property8, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property9, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property10, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property11, false, false), + selector +); + } + /// /// WhenAnyValue allows you to observe whenever the value of one or more @@ -976,23 +1401,40 @@ public static IObservable WhenAnyDynamic(this TSender This, /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue(this TSender This, - Expression> property1, - Expression> property2, - Expression> property3, - Expression> property4, - Expression> property5, - Expression> property6, - Expression> property7, - Expression> property8, - Expression> property9, - Expression> property10, - Expression> property11, - Expression> property12, - Func selector) => - This.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, property10, property11, property12, - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) => - selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value, c11.Value, c12.Value)); + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The 11 property chain to reference. This will be a expression pointing to a end property or field. + /// The 12 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue( + this TSender sender, + Expression> property1, + Expression> property2, + Expression> property3, + Expression> property4, + Expression> property5, + Expression> property6, + Expression> property7, + Expression> property8, + Expression> property9, + Expression> property10, + Expression> property11, + Expression> property12, + Func selector) + { + return sender.WhenAny(property1, property2, property3, property4, property5, property6, property7, property8, property9, property10, property11, property12, + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) => + selector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value, c8.Value, c9.Value, c10.Value, c11.Value, c12.Value)); + } /// /// WhenAny allows you to observe whenever one or more properties on an @@ -1001,7 +1443,22 @@ public static IObservable WhenAnyValue - public static IObservable WhenAny(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The 11 property chain to reference. This will be a expression pointing to a end property or field. + /// The 12 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAny( + this TSender sender, Expression> property1, Expression> property2, Expression> property3, @@ -1014,22 +1471,25 @@ public static IObservable WhenAny> property10, Expression> property11, Expression> property12, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - This.ObservableForProperty(property1, false, false), - This.ObservableForProperty(property2, false, false), - This.ObservableForProperty(property3, false, false), - This.ObservableForProperty(property4, false, false), - This.ObservableForProperty(property5, false, false), - This.ObservableForProperty(property6, false, false), - This.ObservableForProperty(property7, false, false), - This.ObservableForProperty(property8, false, false), - This.ObservableForProperty(property9, false, false), - This.ObservableForProperty(property10, false, false), - This.ObservableForProperty(property11, false, false), - This.ObservableForProperty(property12, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + sender.ObservableForProperty(property1, false, false), + sender.ObservableForProperty(property2, false, false), + sender.ObservableForProperty(property3, false, false), + sender.ObservableForProperty(property4, false, false), + sender.ObservableForProperty(property5, false, false), + sender.ObservableForProperty(property6, false, false), + sender.ObservableForProperty(property7, false, false), + sender.ObservableForProperty(property8, false, false), + sender.ObservableForProperty(property9, false, false), + sender.ObservableForProperty(property10, false, false), + sender.ObservableForProperty(property11, false, false), + sender.ObservableForProperty(property12, false, false), + selector +); + } + /// /// WhenAny allows you to observe whenever one or more properties on an @@ -1038,7 +1498,22 @@ public static IObservable WhenAny - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + /// The 1 property chain to reference. This will be a expression pointing to a end property or field. + /// The 2 property chain to reference. This will be a expression pointing to a end property or field. + /// The 3 property chain to reference. This will be a expression pointing to a end property or field. + /// The 4 property chain to reference. This will be a expression pointing to a end property or field. + /// The 5 property chain to reference. This will be a expression pointing to a end property or field. + /// The 6 property chain to reference. This will be a expression pointing to a end property or field. + /// The 7 property chain to reference. This will be a expression pointing to a end property or field. + /// The 8 property chain to reference. This will be a expression pointing to a end property or field. + /// The 9 property chain to reference. This will be a expression pointing to a end property or field. + /// The 10 property chain to reference. This will be a expression pointing to a end property or field. + /// The 11 property chain to reference. This will be a expression pointing to a end property or field. + /// The 12 property chain to reference. This will be a expression pointing to a end property or field. + /// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, Expression property1, Expression property2, Expression property3, @@ -1051,243 +1526,487 @@ public static IObservable WhenAnyDynamic(this TSender This, Expression property10, Expression property11, Expression property12, - Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) => - Observable.CombineLatest( - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property1, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property2, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property3, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property4, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property5, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property6, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property7, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property8, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property9, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property10, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property11, false, false), - ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property12, false, false), - selector - ); + Func, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, IObservedChange, TRet> selector) + { + return Observable.CombineLatest( + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property1, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property2, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property3, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property4, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property5, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property6, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property7, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property8, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property9, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property10, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property11, false, false), + ReactiveNotifyPropertyChangedMixin + .SubscribeToExpressionChain(sender, property12, false, false), + selector +); + } } + /// A mixin which provides support for subscribing to observable properties. public static class WhenAnyObservableMixin { - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1) - where TSender : class => - This.WhenAny(obs1, x => x.Value.EmptyIfNull()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2) - where TSender : class => - This.WhenAny(obs1, obs2, (o1, o2) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull() }) + /// Observe a observable which is set to a property, and automatically subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The first observable to observe. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1) + where TSender : class + { + return sender.WhenAny(obs1, x => x.Value.EmptyIfNull()).Switch(); + } + + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2) + where TSender : class + { + return sender.WhenAny(obs1, obs2, (o1, o2) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, (o1, o2, o3) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, (o1, o2, o3) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, (o1, o2, o3, o4) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, (o1, o2, o3, o4) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, (o1, o2, o3, o4, o5) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, (o1, o2, o3, o4, o5) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, (o1, o2, o3, o4, o5, o6) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, (o1, o2, o3, o4, o5, o6) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, (o1, o2, o3, o4, o5, o6, o7) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 7 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, (o1, o2, o3, o4, o5, o6, o7) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, (o1, o2, o3, o4, o5, o6, o7, o8) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 7 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 8 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, (o1, o2, o3, o4, o5, o6, o7, o8) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, (o1, o2, o3, o4, o5, o6, o7, o8, o9) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 7 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 8 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 9 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, (o1, o2, o3, o4, o5, o6, o7, o8, o9) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9, Expression>> obs10) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 7 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 8 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 9 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 10 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9, Expression>> obs10) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9, Expression>> obs10, Expression>> obs11) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 7 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 8 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 9 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 10 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 11 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9, Expression>> obs10, Expression>> obs11) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9, Expression>> obs10, Expression>> obs11, Expression>> obs12) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, obs12, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull(), o12.Value.EmptyIfNull() }) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 2 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 3 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 4 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 5 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 6 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 7 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 8 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 9 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 10 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 11 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + /// The 12 property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1, Expression>> obs2, Expression>> obs3, Expression>> obs4, Expression>> obs5, Expression>> obs6, Expression>> obs7, Expression>> obs8, Expression>> obs9, Expression>> obs10, Expression>> obs11, Expression>> obs12) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, obs12, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12) => new[] { o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull(), o12.Value.EmptyIfNull() }) .Select(x => x.Merge()).Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, (o1, o2) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), selector)) + } + + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, (o1, o2) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, (o1, o2, o3) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, (o1, o2, o3) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, (o1, o2, o3, o4) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, (o1, o2, o3, o4) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, (o1, o2, o3, o4, o5) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, (o1, o2, o3, o4, o5) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, (o1, o2, o3, o4, o5, o6) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, (o1, o2, o3, o4, o5, o6) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Expression>> obs7, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, (o1, o2, o3, o4, o5, o6, o7) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The 7 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Expression>> obs7, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, (o1, o2, o3, o4, o5, o6, o7) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Expression>> obs7, - Expression>> obs8, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, (o1, o2, o3, o4, o5, o6, o7, o8) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The 7 property chain to reference. + /// The 8 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Expression>> obs7, + Expression>> obs8, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, (o1, o2, o3, o4, o5, o6, o7, o8) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Expression>> obs7, - Expression>> obs8, - Expression>> obs9, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, (o1, o2, o3, o4, o5, o6, o7, o8, o9) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The 7 property chain to reference. + /// The 8 property chain to reference. + /// The 9 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Expression>> obs7, + Expression>> obs8, + Expression>> obs9, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, (o1, o2, o3, o4, o5, o6, o7, o8, o9) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Expression>> obs7, - Expression>> obs8, - Expression>> obs9, - Expression>> obs10, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The 7 property chain to reference. + /// The 8 property chain to reference. + /// The 9 property chain to reference. + /// The 10 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Expression>> obs7, + Expression>> obs8, + Expression>> obs9, + Expression>> obs10, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Expression>> obs7, - Expression>> obs8, - Expression>> obs9, - Expression>> obs10, - Expression>> obs11, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The 7 property chain to reference. + /// The 8 property chain to reference. + /// The 9 property chain to reference. + /// The 10 property chain to reference. + /// The 11 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Expression>> obs7, + Expression>> obs8, + Expression>> obs9, + Expression>> obs10, + Expression>> obs11, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull(), selector)) .Switch(); - - public static IObservable WhenAnyObservable(this TSender This, - Expression>> obs1, - Expression>> obs2, - Expression>> obs3, - Expression>> obs4, - Expression>> obs5, - Expression>> obs6, - Expression>> obs7, - Expression>> obs8, - Expression>> obs9, - Expression>> obs10, - Expression>> obs11, - Expression>> obs12, - Func selector) - where TSender : class => - This.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, obs12, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull(), o12.Value.EmptyIfNull(), selector)) + } + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The 1 property chain to reference. + /// The 2 property chain to reference. + /// The 3 property chain to reference. + /// The 4 property chain to reference. + /// The 5 property chain to reference. + /// The 6 property chain to reference. + /// The 7 property chain to reference. + /// The 8 property chain to reference. + /// The 9 property chain to reference. + /// The 10 property chain to reference. + /// The 11 property chain to reference. + /// The 12 property chain to reference. + /// The selector which will determine the final value from the properties. This must be an observable. + public static IObservable WhenAnyObservable(this TSender sender, + Expression>> obs1, + Expression>> obs2, + Expression>> obs3, + Expression>> obs4, + Expression>> obs5, + Expression>> obs6, + Expression>> obs7, + Expression>> obs8, + Expression>> obs9, + Expression>> obs10, + Expression>> obs11, + Expression>> obs12, + Func selector) + where TSender : class + { + return sender.WhenAny(obs1, obs2, obs3, obs4, obs5, obs6, obs7, obs8, obs9, obs10, obs11, obs12, (o1, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12) => Observable.CombineLatest(o1.Value.EmptyIfNull(), o2.Value.EmptyIfNull(), o3.Value.EmptyIfNull(), o4.Value.EmptyIfNull(), o5.Value.EmptyIfNull(), o6.Value.EmptyIfNull(), o7.Value.EmptyIfNull(), o8.Value.EmptyIfNull(), o9.Value.EmptyIfNull(), o10.Value.EmptyIfNull(), o11.Value.EmptyIfNull(), o12.Value.EmptyIfNull(), selector)) .Switch(); + } } internal static class ObservableExtensions { - public static IObservable EmptyIfNull(this IObservable @this) => @this ?? Observable.Empty; + public static IObservable EmptyIfNull(this IObservable @this) + { + return @this ?? Observable.Empty; + } } } diff --git a/src/ReactiveUI/VariadicTemplates.tt b/src/ReactiveUI/VariadicTemplates.tt index a4a850cb63..4745aa02d9 100644 --- a/src/ReactiveUI/VariadicTemplates.tt +++ b/src/ReactiveUI/VariadicTemplates.tt @@ -16,14 +16,9 @@ //------------------------------------------------------------------------------ using System; -using System.Collections.Generic; -using System.Reactive.Disposables; using System.Reactive.Linq; -using System.Diagnostics.Contracts; using System.Linq; using System.Linq.Expressions; -using System.Reflection; -using System.Text; <# // NB: maxFuncLength is 4 on WP7, 12 on every other platform. @@ -45,11 +40,13 @@ namespace ReactiveUI /// method in constructors to set up bindings between properties that also /// need an initial setup. /// + /// The object where the property chain starts. + /// The first property chain to reference. This will be a expression pointing to a end property or field. public static IObservable WhenAnyValue( - this TSender This, + this TSender sender, Expression> property1) { - return This.WhenAny(property1, (IObservedChange c1) => c1.Value); + return sender.WhenAny(property1, (IObservedChange c1) => c1.Value); } <# for(int length=1; length <= maxFuncLength; length++) { #> @@ -61,22 +58,24 @@ namespace ReactiveUI <# string dynamicSelectorTypeParams = String.Join(", ", templParams.Select(x => "IObservedChange")); #> <# string selectorCall = "selector(" + String.Join(", ", Enumerable.Range(1, length).Select(x => "islot" + x.ToString())) + ")"; #> - <# if (length != 1 && length <= 7) { #> - /// + <# if (length != 1 && length <= 7) { #>/// /// WhenAnyValue allows you to observe whenever the value of one or more /// properties on an object have changed, providing an initial value when /// the Observable is set up, unlike ObservableForProperty(). Use this /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable<(<#= String.Join(",", templParams) #>)> WhenAnyValue>( - this TSender This, + /// The object where the property chain starts. + <# for(int i=1; i <= length; i++) { #> +/// The <#=i#> property chain to reference. This will be a expression pointing to a end property or field. + <# } #>public static IObservable<(<#= String.Join(",", templParams) #>)> WhenAnyValue>( + this TSender sender, <# for(int i=1; i <= length; i++) { #> Expression>> property<#=i#><# if (i != length) { #>,<# } #> <# } #>) { - return This.WhenAny(<#= valuePropertyParams #>, + return sender.WhenAny(<#= valuePropertyParams #>, (<#= valueSelectorParams #>) => (<#= valueSelectorArgs #>)); } @@ -89,13 +88,18 @@ namespace ReactiveUI /// method in constructors to set up bindings between properties that also /// need an initial setup. /// - public static IObservable WhenAnyValue>(this TSender This, + /// The object where the property chain starts. + <# for(int i=1; i <= length; i++) { #> +/// The <#=i#> property chain to reference. This will be a expression pointing to a end property or field. + <# } #>/// The selector which will determine the final value from the properties. + public static IObservable WhenAnyValue>( + this TSender sender, <# for(int i=1; i <= length; i++) { #> - Expression>> property<#=i#>, + Expression>> property<#=i#>, <# } #> - Func<<#= String.Join(",", templParams) #>, TRet> selector) + Func<<#= String.Join(",", templParams) #>, TRet> selector) { - return This.WhenAny(<#= valuePropertyParams #>, + return sender.WhenAny(<#= valuePropertyParams #>, (<#= valueSelectorParams #>) => selector(<#= valueSelectorArgs #>)); } @@ -107,18 +111,23 @@ namespace ReactiveUI /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAny>(this TSender This, + /// The object where the property chain starts. + <# for(int i=1; i <= length; i++) { #> +/// The <#=i#> property chain to reference. This will be a expression pointing to a end property or field. + <# } #>/// The selector which will determine the final value from the properties. + public static IObservable WhenAny>( + this TSender sender, <# for(int i=1; i <= length; i++) { #> Expression>> property<#=i#>, <# } #> Func<<#= selectorTypeParams #>, TRet> selector) { <# if (length == 1){ #> - return This.ObservableForProperty(property<#=1#>, false, false).Select(selector); + return sender.ObservableForProperty(property<#=1#>, false, false).Select(selector); <# }else{ #> return Observable.CombineLatest( <# for(int i=1; i <= length; i++) { #> - This.ObservableForProperty(property<#=i#>, false, false), + sender.ObservableForProperty(property<#=i#>, false, false), <# } #> selector ); @@ -133,7 +142,12 @@ namespace ReactiveUI /// constructors to set up bindings between properties that also need an /// initial setup. /// - public static IObservable WhenAnyDynamic(this TSender This, + /// The object where the property chain starts. + <# for(int i=1; i <= length; i++) { #> +/// The <#=i#> property chain to reference. This will be a expression pointing to a end property or field. + <# } #>/// The selector which will determine the final value from the properties. + public static IObservable WhenAnyDynamic( + this TSender sender, <# for(int i=1; i <= length; i++) { #> Expression property<#=i#>, <# } #> @@ -141,12 +155,12 @@ namespace ReactiveUI { <# if (length == 1){ #> return ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property<#=1#>, false, false).Select(selector); + .SubscribeToExpressionChain(sender, property<#=1#>, false, false).Select(selector); <# }else{ #> return Observable.CombineLatest( <# for(int i=1; i <= length; i++) { #> ReactiveNotifyPropertyChangedMixin - .SubscribeToExpressionChain(This, property<#=i#>, false, false), + .SubscribeToExpressionChain(sender, property<#=i#>, false, false), <# } #> selector ); @@ -155,39 +169,53 @@ namespace ReactiveUI <# } #> } + /// A mixin which provides support for subscribing to observable properties. public static class WhenAnyObservableMixin { - public static IObservable WhenAnyObservable(this TSender This, Expression>> obs1) + /// Observe a observable which is set to a property, and automatically subscribe to the most recent emitted value. + /// The object where the property chain starts. + /// The first observable to observe. + public static IObservable WhenAnyObservable(this TSender sender, Expression>> obs1) where TSender : class { - return This.WhenAny(obs1, x => x.Value.EmptyIfNull()).Switch(); + return sender.WhenAny(obs1, x => x.Value.EmptyIfNull()).Switch(); } <# for(int length=2; length <= maxFuncLength; length++) { #> + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + <# for(int i=1; i <= length; i++) { #> +/// The <#=i#> property chain to reference which ends with an observable. This will be a expression pointing to a end property or field which must be an observable. + <# } #> <# string paramsStr = String.Join(", ", Enumerable.Range(1, length).Select(x => "Expression>> obs" + x.ToString())); #> <# string varsStr = String.Join(", ", Enumerable.Range(1, length).Select(x => "obs" + x.ToString())); #> <# string valsStr = String.Join(", ", Enumerable.Range(1, length).Select(x => "o" + x.ToString() + ".Value.EmptyIfNull()")); #> - public static IObservable WhenAnyObservable(this TSender This, <#= paramsStr #>) + public static IObservable WhenAnyObservable(this TSender sender, <#= paramsStr #>) where TSender : class { - return This.WhenAny(<#= varsStr #>, (<#=varsStr.Replace("obs", "o")#>) => new[] {<#= valsStr #>}) + return sender.WhenAny(<#= varsStr #>, (<#=varsStr.Replace("obs", "o")#>) => new[] {<#= valsStr #>}) .Select(x => x.Merge()).Switch(); } <# } #> <# for(int length=2; length <= maxFuncLength; length++) { #> + /// Monitor a property that is an observable, and subscribe to the most recent emitted value. + /// The object where the property chain starts. + <# for(int i=1; i <= length; i++) { #> +/// The <#=i#> property chain to reference. + <# } #>/// The selector which will determine the final value from the properties. This must be an observable. <# var templParams = Enumerable.Range(1, length).Select(x => "T" + x.ToString()); #> <# string varsStr = String.Join(", ", Enumerable.Range(1, length).Select(x => "obs" + x.ToString())); #> <# string valsStr = String.Join(", ", Enumerable.Range(1, length).Select(x => "o" + x.ToString() + ".Value.EmptyIfNull()")); #> <# string selectorTypeParams = String.Join(", ", templParams); #> - public static IObservable WhenAnyObservable>(this TSender This, + public static IObservable WhenAnyObservable>(this TSender sender, <# for(int i=1; i <= length; i++) { #> Expression>>> obs<#=i#>, <# } #> Func<<#= selectorTypeParams #>, TRet> selector) where TSender : class { - return This.WhenAny(<#= varsStr #>, (<#=varsStr.Replace("obs", "o")#>) => Observable.CombineLatest(<#= valsStr #>, selector)) + return sender.WhenAny(<#= varsStr #>, (<#=varsStr.Replace("obs", "o")#>) => Observable.CombineLatest(<#= valsStr #>, selector)) .Switch(); } <# } #> diff --git a/src/analyzers.ruleset b/src/analyzers.ruleset deleted file mode 100644 index 603fc2262b..0000000000 --- a/src/analyzers.ruleset +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/analyzers.tests.ruleset b/src/analyzers.tests.ruleset deleted file mode 100644 index dfc0da091e..0000000000 --- a/src/analyzers.tests.ruleset +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -