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();
            }
            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);
            }
            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("*****@*****.**");
            }
            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);
            }