Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/ReactiveUI.Tests/Activation/ActivatingViewFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ActivatingViewFetcher : IActivationForViewFetcher
/// <exception cref="ArgumentNullException">The view is null.</exception>
public IObservable<bool> GetActivationForView(IActivatableView view)
{
if (!(view is ActivatingView av))
if (view is not ActivatingView av)
{
throw new ArgumentNullException(nameof(view));
}
Expand Down
7 changes: 4 additions & 3 deletions src/ReactiveUI.Tests/Activation/ActivatingViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ public void SwitchingViewModelDeactivatesIt()
using (locator.WithResolver())
{
var vm = new ActivatingViewModel();
var fixture = new ActivatingView();

fixture.ViewModel = vm;
var fixture = new ActivatingView
{
ViewModel = vm
};
Assert.Equal(0, vm.IsActiveCount);
Assert.Equal(0, fixture.IsActiveCount);

Expand Down
1 change: 0 additions & 1 deletion src/ReactiveUI.Tests/AutoPersist/AutoPersistHelperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using DynamicData.Binding;
using Microsoft.Reactive.Testing;
using ReactiveUI.Testing;
using Xunit;
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.Tests/Commands/CreatesCommandBindingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// 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.ComponentModel;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using Xunit;

namespace ReactiveUI.Tests
Expand Down
5 changes: 0 additions & 5 deletions src/ReactiveUI.Tests/Commands/ReactiveCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using System.Windows.Input;

using DynamicData;

using Microsoft.Reactive.Testing;

using ReactiveUI.Testing;

using Xunit;

namespace ReactiveUI.Tests
Expand Down
3 changes: 1 addition & 2 deletions src/ReactiveUI.Tests/Comparers/OrderedComparerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Xunit;

namespace ReactiveUI.Tests
Expand Down Expand Up @@ -95,7 +94,7 @@ public void ChainOntoRegularIComparables()
public void WorksWithAnonymousTypes()
{
var source = new List<string> { "abc", "bcd", "cde" };
var items = source.Select(x => new { FirstLetter = x[0], AllOfIt = x }).ToList();
var items = source.ConvertAll(x => new { FirstLetter = x[0], AllOfIt = x });

items.Sort(OrderedComparer.For(items).OrderBy(x => x.FirstLetter));
Assert.True(items.Select(x => x.FirstLetter).SequenceEqual("abc"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Threading.Tasks;

using FluentAssertions;

using Xunit;

namespace ReactiveUI.Tests
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.Tests/Locator/DefaultViewLocatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
// See the LICENSE file in the project root for full license information.

using System;
using System.Diagnostics.CodeAnalysis;

using Splat;

using Xunit;

namespace ReactiveUI.Tests
Expand Down
5 changes: 0 additions & 5 deletions src/ReactiveUI.Tests/Mocks/CommandBindViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
// 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;
using System.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests
{
Expand Down
6 changes: 0 additions & 6 deletions src/ReactiveUI.Tests/Mocks/FakeCollectionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// 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.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions src/ReactiveUI.Tests/Mocks/FakeCollectionViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// 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.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions src/ReactiveUI.Tests/Mocks/FakeNestedViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
// 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;
using System.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests
{
Expand Down
5 changes: 0 additions & 5 deletions src/ReactiveUI.Tests/Mocks/FakeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
// 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;
using System.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests
{
Expand Down
6 changes: 0 additions & 6 deletions src/ReactiveUI.Tests/Mocks/PropertyBindModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// 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.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests
{
/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions src/ReactiveUI.Tests/Mocks/PropertyBindViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
// 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.Text;
using System.Threading.Tasks;
using System.Windows;
using DynamicData.Binding;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
Expand Down Expand Up @@ -541,5 +540,26 @@ public void ToProperty_GivenIndexer_NotifiesOnExpectedPropertyName2() =>
var fixture = new OAPHIndexerTestFixture(2);
});
});

/// <summary>
/// Nullables the types test shouldnt need decorators with toproperty.
/// </summary>
[Fact]
public void NullableTypesTestShouldntNeedDecorators2_ToProperty()
{
WhenAnyTestFixture? fixture = new();
fixture.WhenAnyValue(
x => x.ProjectService.ProjectsNullable,
x => x.AccountService.AccountUsersNullable)
.Where(tuple => tuple.Item1.Any() && tuple.Item2.Any())
.Select(tuple =>
{
var (projects, users) = tuple;
return (int?)users.Values.Count(x => !string.IsNullOrWhiteSpace(x?.LastName));
})
.ToProperty(fixture, x => x.AccountsFound, out fixture._accountsFound);

Assert.Equal(fixture.AccountsFound, 3);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public void GetValueShouldActuallyReturnTheValue()
fixture.ObservableForProperty(x => x.IsOnlyOneWord)
.Select(x => x.GetValue())
.WhereNotNull()
.Subscribe(x =>
{
output.Add(x);
});
.Subscribe(x => output.Add(x));

foreach (var v in input)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

#if NETFX_CORE
#else

using FactAttribute = Xunit.WpfFactAttribute;

#endif

namespace ReactiveUI.Tests.Xaml
Expand Down Expand Up @@ -314,7 +316,7 @@ public void BindToNullShouldThrowHelpfulError()
var view = new PropertyBindView { ViewModel = null };

Assert.Throws<ArgumentNullException>(() =>
view.WhenAnyValue(x => x.FakeControl!.NullHatingString!)
view.WhenAnyValue(x => x.FakeControl.NullHatingString)
.BindTo(view.ViewModel, x => x.Property1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#if NETFX_CORE
#else

using FactAttribute = Xunit.WpfFactAttribute;

#endif

namespace ReactiveUI.Tests.Xaml
Expand All @@ -25,7 +27,7 @@ public class WhenAnyThroughDependencyObjectTests
[Fact]
public void WhenAnyThroughAViewShouldntGiveNullValues()
{
var vm = new HostTestFixture
HostTestFixture? vm = new()
{
Child = new TestFixture
{
Expand All @@ -42,7 +44,7 @@ public void WhenAnyThroughAViewShouldntGiveNullValues()
Assert.Equal(0, output.Count);
Assert.Null(fixture.ViewModel);

fixture.WhenAnyValue(x => x.ViewModel!.Child!.IsNotNullString!).Subscribe(output.Add);
fixture.WhenAnyValue(x => x.ViewModel!.Child!.IsNotNullString).Subscribe(output.Add);

fixture.ViewModel = vm;
Assert.Equal(1, output.Count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
// 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.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ReactiveUI.Tests.Xaml;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
// 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;
using System.Reactive.Concurrency;
using System.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests.Wpf
{
Expand Down
6 changes: 0 additions & 6 deletions src/ReactiveUI.Tests/Platforms/wpf/Mocks/ExampleWindowView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// 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.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Tests.Wpf
{
public class ExampleWindowView : ReactiveWindow<ExampleWindowViewModel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// 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.Text;
using System.Threading.Tasks;

using System.Windows.Controls;

namespace ReactiveUI.Tests.Wpf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Windows.Controls;
using System.Windows.Input;
using FluentAssertions;
using ReactiveUI;
using Splat;
using Xunit;
using FactAttribute = Xunit.WpfFactAttribute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
// See the LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Splat;
using Xunit;

Expand Down
Loading