Esempio n. 1
0
            public void InitializesEndpoint()
            {
                var coreSettings = new CoreSettings {
                    EnableAutomaticReports = true
                };
                var endpoint = Substitute.For <IAnalyticsEndpoint>();
                var client   = new AnalyticsClient(endpoint);

                client.Initialize(coreSettings);

                endpoint.Received().Initialize();
            }
Esempio n. 2
0
            public void SendsReport()
            {
                var coreSettings = new CoreSettings {
                    EnableAutomaticReports = true
                };
                var endpoint = Substitute.For <IAnalyticsEndpoint>();
                var client   = new AnalyticsClient(endpoint);

                client.Initialize(coreSettings);

                client.RecordNonFatalError(new Exception());

                endpoint.ReceivedWithAnyArgs().ReportNonFatalException(null);
            }
Esempio n. 3
0
            public void UpdatesEmailIfSet()
            {
                var coreSettings = new CoreSettings {
                    EnableAutomaticReports = true
                };
                var endpoint = Substitute.For <IAnalyticsEndpoint>();
                var client   = new AnalyticsClient(endpoint);

                client.Initialize(coreSettings);

                client.RecordBugReport("blabla", "*****@*****.**");

                endpoint.Received().UpdateEmail("*****@*****.**");
            }
Esempio n. 4
0
            public void IgnoresEmailIfNullOrEmpty()
            {
                var coreSettings = new CoreSettings {
                    EnableAutomaticReports = true
                };
                var endpoint = Substitute.For <IAnalyticsEndpoint>();
                var client   = new AnalyticsClient(endpoint);

                client.Initialize(coreSettings);

                client.RecordBugReport("blabla");

                endpoint.DidNotReceiveWithAnyArgs().UpdateEmail(Arg.Any <string>());

                client.RecordBugReport("blabla", String.Empty);

                endpoint.DidNotReceiveWithAnyArgs().UpdateEmail(Arg.Any <string>());

                client.RecordBugReport("blabla", "  ");

                endpoint.DidNotReceiveWithAnyArgs().UpdateEmail(null);
            }