Fix a whole bunch of tests
This commit is contained in:
Родитель
409765880f
Коммит
937abb1c39
|
@ -3,6 +3,7 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using MvvmCross.Binding;
|
||||
using MvvmCross.Core;
|
||||
using MvvmCross.Core.Platform;
|
||||
using MvvmCross.Platform.Core;
|
||||
|
@ -30,12 +31,13 @@ namespace MvvmCross.Test
|
|||
return null;
|
||||
}
|
||||
|
||||
public virtual void ClearAll()
|
||||
public virtual void ClearAll(IMvxIocOptions options = null)
|
||||
{
|
||||
// fake set up of the IoC
|
||||
Reset();
|
||||
Ioc = MvxIoCProvider.Initialize(CreateIocOptions());
|
||||
Ioc = MvxIoCProvider.Initialize(options ?? CreateIocOptions());
|
||||
Ioc.RegisterSingleton(Ioc);
|
||||
CreateLog();
|
||||
InitializeSingletonCache();
|
||||
InitializeMvxSettings();
|
||||
AdditionalSetup();
|
||||
|
@ -43,7 +45,11 @@ namespace MvvmCross.Test
|
|||
|
||||
public void InitializeSingletonCache()
|
||||
{
|
||||
MvxSingletonCache.Initialize();
|
||||
if (MvxSingletonCache.Instance == null)
|
||||
MvxSingletonCache.Initialize();
|
||||
|
||||
if (MvxBindingSingletonCache.Instance == null)
|
||||
MvxBindingSingletonCache.Initialize();
|
||||
}
|
||||
|
||||
protected virtual void InitializeMvxSettings()
|
||||
|
@ -53,7 +59,18 @@ namespace MvvmCross.Test
|
|||
|
||||
protected virtual void AdditionalSetup()
|
||||
{
|
||||
Ioc.RegisterSingleton<IMvxLogProvider>(new TestLogProvider());
|
||||
}
|
||||
|
||||
protected virtual void CreateLog()
|
||||
{
|
||||
var logProvider = new TestLogProvider();
|
||||
Ioc.RegisterSingleton<IMvxLogProvider>(logProvider);
|
||||
|
||||
var globalLog = logProvider.GetLogFor<MvxLog>();
|
||||
MvxLog.Instance = globalLog;
|
||||
Ioc.RegisterSingleton(globalLog);
|
||||
|
||||
var pluginLog = logProvider.GetLogFor("MvxPlugin");
|
||||
}
|
||||
|
||||
public void SetInvariantCulture()
|
||||
|
|
|
@ -9,12 +9,21 @@ using MvvmCross.Platform.IoC;
|
|||
using Xunit;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using MvvmCross.Test;
|
||||
|
||||
namespace MvvmCross.Platform.Test
|
||||
{
|
||||
|
||||
[Collection("MvxTest")]
|
||||
public class MvxIocTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
public MvxIocTest(MvxTestFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
_fixture.ClearAll();
|
||||
}
|
||||
|
||||
public interface IA
|
||||
{
|
||||
IB B { get; }
|
||||
|
@ -112,19 +121,16 @@ namespace MvvmCross.Platform.Test
|
|||
public void TryResolve_CircularButSafeDynamicWithOptionOff_ReturnsTrue()
|
||||
{
|
||||
COdd.FirstTime = true;
|
||||
MvxSingleton.ClearAllSingletons();
|
||||
var options = new MvxIocOptions()
|
||||
_fixture.ClearAll(new MvxIocOptions()
|
||||
{
|
||||
TryToDetectDynamicCircularReferences = false
|
||||
};
|
||||
var instance = MvxIoCProvider.Initialize(options);
|
||||
});
|
||||
|
||||
Mvx.RegisterType<IA, A>();
|
||||
Mvx.RegisterType<IB, B>();
|
||||
Mvx.RegisterType<IC, COdd>();
|
||||
_fixture.Ioc.RegisterType<IA, A>();
|
||||
_fixture.Ioc.RegisterType<IB, B>();
|
||||
_fixture.Ioc.RegisterType<IC, COdd>();
|
||||
|
||||
IA a;
|
||||
var result = Mvx.TryResolve(out a);
|
||||
var result = _fixture.Ioc.TryResolve(out IA a);
|
||||
Assert.True(result);
|
||||
Assert.NotNull(a);
|
||||
}
|
||||
|
@ -133,15 +139,13 @@ namespace MvvmCross.Platform.Test
|
|||
public void TryResolve_CircularButSafeDynamicWithOptionOn_ReturnsFalse()
|
||||
{
|
||||
COdd.FirstTime = true;
|
||||
MvxSingleton.ClearAllSingletons();
|
||||
var instance = MvxIoCProvider.Initialize();
|
||||
_fixture.ClearAll();
|
||||
|
||||
Mvx.RegisterType<IA, A>();
|
||||
Mvx.RegisterType<IB, B>();
|
||||
Mvx.RegisterType<IC, COdd>();
|
||||
_fixture.Ioc.RegisterType<IA, A>();
|
||||
_fixture.Ioc.RegisterType<IB, B>();
|
||||
_fixture.Ioc.RegisterType<IC, COdd>();
|
||||
|
||||
IA a;
|
||||
var result = Mvx.TryResolve(out a);
|
||||
var result = _fixture.Ioc.TryResolve(out IA a);
|
||||
Assert.False(result);
|
||||
Assert.Null(a);
|
||||
}
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MS-PL license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Xunit;
|
||||
|
||||
namespace MvvmCross.Platform.Test
|
||||
{
|
||||
|
||||
public class ReflectionExtensionsTests
|
||||
{
|
||||
private class TestClass
|
||||
{
|
||||
public static readonly object PublicStaticField = new object();
|
||||
|
||||
public object PublicInstanceField1 = new object();
|
||||
public object PublicInstanceField2 = new object();
|
||||
|
||||
private object _privateInstanceField1 = new object();
|
||||
|
||||
public TestClass()
|
||||
{
|
||||
}
|
||||
|
||||
public TestClass(object param1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class TestSubClass : TestBaseClass
|
||||
{
|
||||
public object PublicSubInstanceField1 = new object();
|
||||
|
||||
private object _privateInstanceField1 = new object();
|
||||
}
|
||||
|
||||
private class TestBaseClass
|
||||
{
|
||||
public object PublicBaseInstanceField1 = new object();
|
||||
public object PublicBaseInstanceField2 = new object();
|
||||
|
||||
private object _privateBaseInstanceField1 = new object();
|
||||
|
||||
public TestBaseClass()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#region Fields
|
||||
|
||||
[Fact]
|
||||
public void TestGetStaticFields()
|
||||
{
|
||||
// Act
|
||||
var fields = typeof(TestClass).GetFields(BindingFlags.Static);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1, fields.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetPublicInstanceFields()
|
||||
{
|
||||
// Act
|
||||
var fields = typeof(TestClass).GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(2, fields.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetAllInstanceFields()
|
||||
{
|
||||
// Act
|
||||
var fields = typeof(TestClass).GetFields(BindingFlags.Instance);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(3, fields.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetAllFields()
|
||||
{
|
||||
// Act
|
||||
var fields = typeof(TestClass).GetFields();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(3, fields.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetInstanceFieldByNameStaticFieldSpecified()
|
||||
{
|
||||
// Act
|
||||
var field = typeof(TestClass).GetField("PublicStaticField", BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(field);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetInstanceFieldByNameReturnsNullIfStaticFieldSpecified()
|
||||
{
|
||||
// Act
|
||||
var field = typeof(TestClass).GetField("PublicStaticField", BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
// Assert
|
||||
Assert.Null(field);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetInstanceFieldByNameInstanceFieldSpecified()
|
||||
{
|
||||
// Act
|
||||
var field = typeof(TestClass).GetField("PublicInstanceField1", BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(field);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetStaticFieldByNameReturnsNullIfInstanceFieldSpecified()
|
||||
{
|
||||
// Act
|
||||
var field = typeof(TestClass).GetField("PublicInstanceField1", BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
// Assert
|
||||
Assert.Null(field);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFlattenHierarchyGetsAllFields()
|
||||
{
|
||||
// Act
|
||||
var fields = typeof(TestSubClass).GetFields(BindingFlags.Public | BindingFlags.FlattenHierarchy);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(3, fields.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFlattenHierarchyGetsOnlyDeclaredFields()
|
||||
{
|
||||
// Act
|
||||
var fields = typeof(TestSubClass).GetFields(BindingFlags.Public);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1, fields.Count());
|
||||
}
|
||||
|
||||
#endregion Fields
|
||||
|
||||
[Fact]
|
||||
public void TestGetConstructors()
|
||||
{
|
||||
// Act
|
||||
var ctors = typeof(TestClass).GetConstructors();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(2, ctors.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestGetBaseConstructor()
|
||||
{
|
||||
// Act
|
||||
var ctors = typeof(TestSubClass).GetConstructors();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1, ctors.Count());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ using Xunit;
|
|||
namespace MvvmCross.Binding.Test.Binders
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxSourceStepTests : IClassFixture<MvxTestFixture>
|
||||
public class MvxSourceStepTests
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ using Xunit;
|
|||
namespace MvvmCross.Binding.Test.Bindings
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxFullBindingConstructionTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxFullBindingConstructionTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ using Xunit;
|
|||
namespace MvvmCross.Binding.Test.Bindings
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxFullBindingTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxFullBindingTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ using Xunit;
|
|||
namespace MvvmCross.Binding.Test.Bindings
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxFullBindingValueConversionTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxFullBindingValueConversionTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ using Xunit;
|
|||
namespace MvvmCross.Binding.Test.ExpressionParse
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxExpressionBindingTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxExpressionBindingTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ using Xunit;
|
|||
|
||||
namespace MvvmCross.Binding.Test.ExtensionMethods
|
||||
{
|
||||
|
||||
public class MakeSafeValueTest : IClassFixture<MvxTestFixture>
|
||||
[Collection("MvxTest")]
|
||||
public class MakeSafeValueTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestIntValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
Assert.Equal(0, typeof(int).MakeSafeValue(0));
|
||||
Assert.Equal(0, typeof(int).MakeSafeValue(null));
|
||||
|
@ -55,7 +55,7 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestDoubleValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
Assert.Equal(0.0, typeof(double).MakeSafeValue(0.0));
|
||||
Assert.Equal(0.0, typeof(double).MakeSafeValue(null));
|
||||
|
@ -71,16 +71,16 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestFloatValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
Assert.Equal(0.0f, typeof(double).MakeSafeValue(0.0f));
|
||||
Assert.Equal(0.0f, typeof(double).MakeSafeValue(null));
|
||||
Assert.Equal(1.0f, typeof(double).MakeSafeValue(1.0f));
|
||||
Assert.Equal(0.0f, typeof(double?).MakeSafeValue(0.0f));
|
||||
Assert.Equal(0.0f, typeof(float).MakeSafeValue(0.0f));
|
||||
Assert.Equal(0.0f, typeof(float).MakeSafeValue(null));
|
||||
Assert.Equal(1.0f, typeof(float).MakeSafeValue(1.0f));
|
||||
Assert.Equal(0.0f, typeof(float?).MakeSafeValue(0.0f));
|
||||
Assert.Null(typeof(double?).MakeSafeValue(null));
|
||||
Assert.Equal(1.0f, typeof(double?).MakeSafeValue(1.0f));
|
||||
Assert.Equal(1.0f, typeof(double).MakeSafeValue(1f));
|
||||
Assert.Equal(0.0f, typeof(double?).MakeSafeValue(0f));
|
||||
Assert.Equal(1.0f, typeof(float?).MakeSafeValue(1.0f));
|
||||
Assert.Equal(1.0f, typeof(float).MakeSafeValue(1f));
|
||||
Assert.Equal(0.0f, typeof(float?).MakeSafeValue(0f));
|
||||
}
|
||||
|
||||
public class MyTest
|
||||
|
@ -95,7 +95,7 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestStringValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
Assert.Equal("0", typeof(string).MakeSafeValue(0.0));
|
||||
Assert.Null(typeof(string).MakeSafeValue(null));
|
||||
|
@ -115,7 +115,7 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestEnumValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
Assert.Equal(SampleEnum.Defaulto, typeof(SampleEnum).MakeSafeValue(0));
|
||||
Assert.Equal(SampleEnum.Defaulto, typeof(SampleEnum).MakeSafeValue(null));
|
||||
|
@ -128,7 +128,7 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestBoolValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
Assert.False((bool)typeof(bool).MakeSafeValue(0));
|
||||
Assert.False((bool)typeof(bool).MakeSafeValue(null));
|
||||
|
@ -159,7 +159,7 @@ namespace MvvmCross.Binding.Test.ExtensionMethods
|
|||
public void TestObjectValues()
|
||||
{
|
||||
_fixture.ClearAll();
|
||||
Mvx.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
_fixture.Ioc.RegisterSingleton<IMvxAutoValueConverters>(new MockAutoValueConverters());
|
||||
|
||||
var foo = new Foo();
|
||||
Assert.Equal(foo, typeof(FooBase).MakeSafeValue(foo));
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace MvvmCross.Binding.Test.Parse.Binding.Swiss
|
|||
Path = "Foo",
|
||||
},
|
||||
},
|
||||
ConverterParameter = 12
|
||||
ConverterParameter = 12L
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace MvvmCross.Binding.Test.Parse.Binding.Swiss
|
|||
},
|
||||
new MvxSerializableBindingDescription()
|
||||
{
|
||||
Literal = 12,
|
||||
Literal = 12L,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ namespace MvvmCross.Binding.Test.Parse.Binding.Swiss
|
|||
{
|
||||
Path = "Foo2",
|
||||
Converter = "Second",
|
||||
FallbackValue = 23,
|
||||
FallbackValue = 23L,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -236,7 +236,7 @@ namespace MvvmCross.Binding.Test.Parse.Binding.Swiss
|
|||
},
|
||||
new MvxSerializableBindingDescription()
|
||||
{
|
||||
Literal = 23,
|
||||
Literal = 23L,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ namespace MvvmCross.Binding.Test.Parse.Binding.Swiss
|
|||
{
|
||||
Path = "Foo2",
|
||||
Converter = "Second",
|
||||
FallbackValue = 23,
|
||||
FallbackValue = 23L,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -348,7 +348,7 @@ namespace MvvmCross.Binding.Test.Parse.Binding.Swiss
|
|||
{
|
||||
Path = "Foo2",
|
||||
Converter = "Second",
|
||||
FallbackValue = 23,
|
||||
FallbackValue = 23L,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -175,14 +175,14 @@ namespace MvvmCross.Binding.Test.Parse.PropertyPath
|
|||
|
||||
private static void AssertIsSimplePropertyToken(MvxPropertyToken token, string text)
|
||||
{
|
||||
Assert.IsType<MvxPropertyNamePropertyToken>(token);
|
||||
Assert.IsAssignableFrom<MvxPropertyNamePropertyToken>(token);
|
||||
Assert.Equal(text, ((MvxPropertyNamePropertyToken)token).PropertyName);
|
||||
}
|
||||
|
||||
private static void AssertIsIndexerPropertyToken<T, TSpecific>(MvxPropertyToken token, T value)
|
||||
{
|
||||
Assert.IsType<MvxIndexerPropertyToken<T>>(token);
|
||||
Assert.IsType<TSpecific>(token);
|
||||
Assert.IsAssignableFrom<MvxIndexerPropertyToken<T>>(token);
|
||||
Assert.IsAssignableFrom<TSpecific>(token);
|
||||
Assert.Equal(value, ((MvxIndexerPropertyToken<T>)token).Key);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ using System.Linq;
|
|||
using MvvmCross.Core.ViewModels;
|
||||
using MvvmCross.Core.Views;
|
||||
using MvvmCross.Platform.Core;
|
||||
using MvvmCross.Platform.Logging;
|
||||
|
||||
namespace MvvmCross.Test.Mocks.Dispatchers
|
||||
{
|
||||
public class NavigationMockDispatcher
|
||||
: MvxMainThreadDispatcher, IMvxViewDispatcher
|
||||
: IMvxMainThreadDispatcher, IMvxViewDispatcher
|
||||
{
|
||||
public readonly List<MvxViewModelRequest> Requests = new List<MvxViewModelRequest>();
|
||||
public readonly List<MvxPresentationHint> Hints = new List<MvxPresentationHint>();
|
||||
|
@ -32,7 +33,7 @@ namespace MvvmCross.Test.Mocks.Dispatchers
|
|||
debugString += $"with parameters: {string.Join(",", request.ParameterValues.Select(pair => $"{{ {pair.Key}={pair.Value} }}"))}";
|
||||
else
|
||||
debugString += "without parameters";
|
||||
Debug.WriteLine(debugString);
|
||||
MvxTestLog.Instance.Log(MvxLogLevel.Debug, () => debugString);
|
||||
|
||||
Requests.Add(request);
|
||||
return true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MS-PL license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
@ -16,13 +16,13 @@ namespace MvvmCross.Test.Navigation
|
|||
{
|
||||
[Collection("MvxTest")]
|
||||
public class NavigationServiceTests
|
||||
: IClassFixture<MvxTestFixture>
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
public NavigationServiceTests(MvxTestFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
_fixture.ClearAll();
|
||||
AdditionalSetup(fixture);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace MvvmCross.Test.Navigation
|
|||
{
|
||||
[Collection("MvxTest")]
|
||||
public class RoutingServiceTests
|
||||
: IClassFixture<MvxTestFixture>
|
||||
{
|
||||
protected Mock<NavigationMockDispatcher> MockDispatcher;
|
||||
protected IMvxNavigationService RoutingService;
|
||||
|
@ -35,6 +34,7 @@ namespace MvvmCross.Test.Navigation
|
|||
public RoutingServiceTests(MvxTestFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
_fixture.ClearAll();
|
||||
|
||||
MvxNavigationService.LoadRoutes(new[] { typeof(RoutingServiceTests).Assembly });
|
||||
// ReSharper disable once AssignNullToNotNullAttribute
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace MvvmCross.Test.Parse
|
|||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxStringDictionaryTextSerializerTest
|
||||
: IClassFixture<MvxTestFixture>
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MS-PL license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
@ -9,7 +9,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.Platform
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxSimplePropertyDictionaryExtensionMethodsTests : IClassFixture<MvxTestFixture>
|
||||
public class MvxSimplePropertyDictionaryExtensionMethodsTests
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -10,13 +10,14 @@ using Xunit;
|
|||
namespace MvvmCross.Test.Platform
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxStringToTypeParserTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxStringToTypeParserTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
public MvxStringToTypeParserTest(MvxTestFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
_fixture.ClearAll();
|
||||
_fixture.SetInvariantCulture();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.Platform
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxViewModelByNameLookupTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxViewModelByNameLookupTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MS-PL license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
@ -10,7 +10,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.Platform
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxViewModelViewLookupBuilderTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxViewModelViewLookupBuilderTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.Platform
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxViewModelViewTypeFinderTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxViewModelViewTypeFinderTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.ViewModels
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxBundleTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxBundleTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.ViewModels
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxCommandCollectionTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxCommandCollectionTest
|
||||
{
|
||||
private MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.ViewModels
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxDefaultViewModelLocatorTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxDefaultViewModelLocatorTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ using Xunit;
|
|||
|
||||
namespace MvvmCross.Test.ViewModels
|
||||
{
|
||||
|
||||
public class MvxNotifyPropertyChangedTest : IClassFixture<MvxTestFixture>
|
||||
[Collection("MvxTest")]
|
||||
public class MvxNotifyPropertyChangedTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.ViewModels
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxSaveStateTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxSaveStateTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MS-PL license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
@ -13,7 +13,7 @@ using Xunit;
|
|||
namespace MvvmCross.Test.ViewModels
|
||||
{
|
||||
[Collection("MvxTest")]
|
||||
public class MvxViewModelLoaderTest : IClassFixture<MvxTestFixture>
|
||||
public class MvxViewModelLoaderTest
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
|
|
|
@ -4,13 +4,20 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using MvvmCross.Plugins.JsonLocalization.Tests.Mocks;
|
||||
using MvvmCross.Test;
|
||||
using Xunit;
|
||||
|
||||
namespace MvvmCross.Plugins.JsonLocalization.Tests
|
||||
{
|
||||
|
||||
public class MvxDictionaryTextProviderTest
|
||||
public class MvxDictionaryTextProviderTest : IClassFixture<MvxTestFixture>
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
public MvxDictionaryTextProviderTest(MvxTestFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetTextWithExistingValueReturnsTheValueWhenMaskingErrors()
|
||||
{
|
||||
|
|
|
@ -5,13 +5,20 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MvvmCross.Test;
|
||||
using Xunit;
|
||||
|
||||
namespace MvvmCross.Plugins.Messenger.Test
|
||||
{
|
||||
|
||||
public class MessengerHubTest
|
||||
public class MessengerHubTest : IClassFixture<MvxTestFixture>
|
||||
{
|
||||
private readonly MvxTestFixture _fixture;
|
||||
|
||||
public MessengerHubTest(MvxTestFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
}
|
||||
|
||||
#region TestClasses
|
||||
|
||||
private class TestMessage : MvxMessage
|
||||
|
@ -32,10 +39,6 @@ namespace MvvmCross.Plugins.Messenger.Test
|
|||
|
||||
#endregion TestClasses
|
||||
|
||||
|
||||
public void SetUp()
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SubscribeAndPublishAllowsMessageToBeReceived()
|
||||
|
|
Загрузка…
Ссылка в новой задаче