Ejemplo n.º 1
0
            public async Task IgnoresEmailIfNullOrEmpty()
            {
                var coreSettings = new CoreSettings { EnableAutomaticReports = true };
                var endpoint = Substitute.For<IAnalyticsEndpoint>();
                var client = new AnalyticsClient(endpoint);
                await client.InitializeAsync(coreSettings);

                await client.RecordBugReportAsync("blabla");

                endpoint.DidNotReceiveWithAnyArgs().UpdateUserEmailAsync(null);

                await client.RecordBugReportAsync("blabla", String.Empty);

                endpoint.DidNotReceiveWithAnyArgs().UpdateUserEmailAsync(null);

                await client.RecordBugReportAsync("blabla", "  ");

                endpoint.DidNotReceiveWithAnyArgs().UpdateUserEmailAsync(null);
            }
Ejemplo n.º 2
0
            public async Task UpdatesEmailIfSet()
            {
                var coreSettings = new CoreSettings { EnableAutomaticReports = true };
                var endpoint = Substitute.For<IAnalyticsEndpoint>();
                var client = new AnalyticsClient(endpoint);
                await client.InitializeAsync(coreSettings);

                await client.RecordBugReportAsync("blabla", "*****@*****.**");

                endpoint.Received().UpdateUserEmailAsync("*****@*****.**");
            }
Ejemplo n.º 3
0
            public async Task ForcesAuthentication()
            {
                var coreSettings = new CoreSettings { EnableAutomaticReports = false };
                var endpoint = Substitute.For<IAnalyticsEndpoint>();
                var client = new AnalyticsClient(endpoint);

                // This won't authenticate because automatic reports are disabled
                await client.InitializeAsync(coreSettings);

                // This will force an authentication even if automatic reports are disabled
                await client.RecordBugReportAsync("blabla");

                Assert.True(client.IsAuthenticated);
                endpoint.Received().RecordErrorAsync(Arg.Is<Exception>(x => x.Message == "blabla"), null);
            }