public void TestXnaTouchLogic() { using (var resolver = new MockResolver()) { var window = resolver.Window; new PixelScreenSpace(window); var touch = new XnaMockTouch(window) { TouchCollection = GetFirstTouchCollection() }; Assert.AreEqual(new Vector2D(0, 0), touch.GetPosition(0)); Assert.AreEqual(State.Released, touch.GetState(0)); touch.Run(); touch.TouchCollection = GetSecondTouchCollection(); touch.Run(); touch.TouchCollection = GetThirtTouchCollection(); touch.Run(); touch.Update(new Entity[] { }); if (!touch.IsAvailable) { return; } //ncrunch: no coverage start Assert.AreEqual(Vector2D.Zero, touch.GetPosition(0)); Assert.AreEqual(State.Released, touch.GetState(0)); } //ncrunch: no coverage end }
private static WindowsMouse GetMouse() { var resolver = new MockResolver(); var window = resolver.Window; var positionTranslater = new CursorPositionTranslater(window); return new WindowsMouse(positionTranslater); }
public FabricMembershipOracleTests(ITestOutputHelper output) { this.Output = output; this.siloDetails = new MockSiloDetails { Name = Guid.NewGuid().ToString("N"), SiloAddress = SiloAddressUtils.NewLocalSiloAddress(SiloAddress.AllocateNewGeneration()) }; this.resolver = new MockResolver(); var globalConfig = new ClusterConfiguration().Globals; globalConfig.MaxMultiClusterGateways = 2; globalConfig.ClusterId = "MegaGoodCluster"; this.fabricMembershipOptions = new ServiceFabricMembershipOptions(); this.unknownSiloMonitor = new UnknownSiloMonitor( new OptionsWrapper <ServiceFabricMembershipOptions>(this.fabricMembershipOptions), new TestOutputLogger <UnknownSiloMonitor>(this.Output)); this.oracle = new FabricMembershipOracle( this.siloDetails, globalConfig, this.resolver, new NullLogger <FabricMembershipOracle>(), this.unknownSiloMonitor); }
public void CreateHook() { resolver = new MockResolver(); var window = resolver.Window; hook = new TouchHook(window); }
public FabricMembershipOracleTests(ITestOutputHelper output) { this.Output = output; this.siloDetails = new MockSiloDetails { Name = Guid.NewGuid().ToString("N"), SiloAddress = SiloAddressUtils.NewLocalSiloAddress(SiloAddress.AllocateNewGeneration()) }; this.resolver = new MockResolver(); var multiClusterOptions = new MultiClusterOptions { HasMultiClusterNetwork = true, MaxMultiClusterGateways = 2 }; this.fabricClusteringOptions = new ServiceFabricClusteringOptions(); this.unknownSiloMonitor = new UnknownSiloMonitor( new OptionsWrapper <ServiceFabricClusteringOptions>(this.fabricClusteringOptions), new TestOutputLogger <UnknownSiloMonitor>(this.Output)); this.oracle = new FabricMembershipOracle( this.siloDetails, this.resolver, new NullLogger <FabricMembershipOracle>(), this.unknownSiloMonitor, Options.Create(multiClusterOptions)); }
public void SetUp() { displayMode = ScreenSpace.Current.Viewport.Aspect >= 1.0f ? Orientation.Landscape : Orientation.Portrait; mockResolver = new MockResolver(); mockKeyboard = mockResolver.Resolve<MockKeyboard>(); mockMouse = mockResolver.Resolve<MockMouse>(); mockTouch = mockResolver.Resolve<MockTouch>(); content = new JewelBlocksContent(); game = new Game(Resolve<Window>()); }
public void SetUp() { displayMode = ScreenSpace.Current.Viewport.Aspect >= 1.0f ? Orientation.Landscape : Orientation.Portrait; mockResolver = new MockResolver(); mockKeyboard = mockResolver.Resolve <MockKeyboard>(); mockMouse = mockResolver.Resolve <MockMouse>(); mockTouch = mockResolver.Resolve <MockTouch>(); content = new JewelBlocksContent(); game = new Game(Resolve <Window>()); }
private void CreateResolver() { mockService = new MockService(); mockServices = new List <MockService> { mockService }; mockResolver = new MockResolver(); mockResolver.GetServiceDelegate = () => mockService; mockResolver.GetServicesDelegate = () => mockServices; }
public void Adding_Resolver_Instance_Should_Create_Instance() { // Arrange var resolver = new MockResolver(); // Act _sut.AddTenantTokenResolver(resolver); var result = _sut.GetTenantTokenResolvers(null).ToList(); // Assert result.Should().NotBeNull(); result.Should().NotBeEmpty(); result.Should().HaveCount(1); result.First().Should().BeOfType <MockResolver>(); ((MockResolver)result.First()).Args.Should().BeNull(); result.First().Should().BeEquivalentTo(resolver); }
public static int Main(String[] args) { // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57851 // If the custom attributes of an assembly trigger a // ResolveEventHandler, and that handler returns an // AssemblyBuilder, don't crash. var h = new MockResolver("assemblyresolve_event5_label"); var aName = new AssemblyName("assemblyresolve_event5_helper"); var a = AppDomain.CurrentDomain.Load(aName); var t = a.GetType("MyClass"); h.StartHandling(); var cas = t.GetCustomAttributes(true); h.StopHandling(); return(0); }
public void Adding_Implementation_Factory_Should_Create_Instance() { // Arrange var resolver = new MockResolver(); ITenantTokenResolver ImplementationFactory(IServiceProvider _) => resolver; // Act _sut.AddTenantTokenResolver(ImplementationFactory); var result = _sut.GetTenantTokenResolvers(null).ToList(); // Assert result.Should().NotBeNull(); result.Should().NotBeEmpty(); result.Should().HaveCount(1); result.First().Should().BeOfType <MockResolver>(); ((MockResolver)result.First()).Args.Should().BeNull(); result.First().Should().BeEquivalentTo(resolver); }
public void InitializeResolver() { if (StackTraceExtensions.ForceUseOfMockResolver()) { resolver = new MockResolver(); return; } //ncrunch: no coverage start if (!StackTraceExtensions.StartedFromProgramMain) { StackTraceExtensions.SetUnitTestName(TestContext.CurrentContext.Test.FullName); } resolver = new XnaResolver(); if (StackTraceExtensions.IsCloseAfterFirstFrameAttributeUsed() || StackTraceExtensions.StartedFromNCrunchOrNunitConsole) { Resolve <Window>().CloseAfterFrame(); } //ncrunch: no coverage end }
public FabricMembershipOracleTests(ITestOutputHelper output) { this.Output = output; this.siloDetails = new MockSiloDetails { Name = Guid.NewGuid().ToString("N"), SiloAddress = SiloAddress.NewLocalAddress(SiloAddress.AllocateNewGeneration()) }; this.resolver = new MockResolver(); var globalConfig = new ClusterConfiguration().Globals; globalConfig.MaxMultiClusterGateways = 2; globalConfig.ClusterId = "MegaGoodCluster"; this.oracle = new FabricMembershipOracle( this.siloDetails, globalConfig, this.resolver, name => new TestOutputLogger(this.Output, name)); }
public void TestXnaTouchLogic() { using (var resolver = new MockResolver()) { var window = resolver.Window; new PixelScreenSpace(window); var touch = new XnaMockTouch(window) { TouchCollection = GetFirstTouchCollection() }; Assert.AreEqual(new Vector2D(0, 0), touch.GetPosition(0)); Assert.AreEqual(State.Released, touch.GetState(0)); touch.Run(); touch.TouchCollection = GetSecondTouchCollection(); touch.Run(); touch.TouchCollection = GetThirtTouchCollection(); touch.Run(); touch.Update(new Entity[] { }); if (!touch.IsAvailable) return; //ncrunch: no coverage start Assert.AreEqual(Vector2D.Zero, touch.GetPosition(0)); Assert.AreEqual(State.Released, touch.GetState(0)); } //ncrunch: no coverage end }
private static WindowsMouse GetMouse() { var resolver = new MockResolver(); return(new WindowsMouse(resolver.Window)); }
public void CreateMockResolver() { resolver = new MockResolver(); }
private static WindowsMouse GetMouse() { var resolver = new MockResolver(); return new WindowsMouse(resolver.Window); }