public void LogSendsIncludesComplexPropertyWhenExtractingAdditionalDataTest() { var name = Guid.NewGuid().ToString(); var sentryId = Guid.NewGuid().ToString(); var eventId = new EventId(Environment.TickCount); var state = new AddressState { Address = Guid.NewGuid().ToString() }; var company = Model.Create <Company>(); var exception = new EmptyException { Company = company }; var client = Substitute.For <IRavenClient>(); client.Capture(Arg.Any <SentryEvent>()).Returns(sentryId); var sut = new SentryLogger(name, client); sut.Log(LogLevel.Critical, eventId, state, exception, (logState, ex) => ex.ToString()); client.Received(1).Capture(Arg.Any <SentryEvent>()); client.Received().Capture( Arg.Is <SentryEvent>(x => x.Exception.Data.Contains("EmptyException.Company"))); }
public void NonEmptyContainerThrows() { List<int> list = new List<int>(); list.Add(42); EmptyException ex = Assert.Throws<EmptyException>(() => Assert.Empty(list)); Assert.Equal("Assert.Empty() Failure", ex.Message); }
public static void NonEmptyContainerThrows() { var list = new List <int>(); list.Add(42); EmptyException ex = Assert.Throws <EmptyException>(() => Assert.Empty(list)); Assert.Equal($"Assert.Empty() Failure{Environment.NewLine}Collection: [42]", ex.Message); }
public static void NonEmptyContainerThrows() { var list = new List <int> { 42 }; EmptyException ex = Assert.Throws <EmptyException>(() => Assert.Empty(list)); Assert.Equal($"Assert.Empty() Failure{Environment.NewLine}Expected: <empty>{Environment.NewLine}Actual: [42]", ex.Message); }
public void IsNotEmpty() { List <int> list = new List <int>(); list.Add(42); EmptyException ex = Assert.Throws <EmptyException>(() => Assert.Empty(list)); Assert.Equal("Assert.Empty() failure", ex.Message); }
public static void NonEmptyStringThrows() { EmptyException ex = Assert.Throws <EmptyException>(() => Assert.Empty("Foo")); Assert.Equal($"Assert.Empty() Failure{Environment.NewLine}Collection: \"Foo\"", ex.Message); }
public void IsNotEmpty() { EmptyException ex = Assert.Throws <EmptyException>(() => Assert.Empty("Foo")); Assert.Equal("Assert.Empty() failure", ex.Message); }
public static void NonEmptyStringThrows() { EmptyException ex = Assert.Throws <EmptyException>(() => Assert.Empty("Foo")); Assert.Equal("Assert.Empty() Failure", ex.Message); }
private void btnFormat_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = ModernDialog.ShowMessage("Are sure you want to format this partition? \nThis operation is unrevertable so think twice or even triple.", "Format Warning", MessageBoxButton.YesNo); txtBlockEnd.Visibility = Visibility.Hidden; if (result == MessageBoxResult.Yes) { string driveLetter = (string)cmbBoxLetter.SelectedItem; string fileSystem = (string)cmbBoxSystem.SelectedItem; string label = txtName.Text; bool quickFormat = true; int clusterSize = 8192; bool enableCompression = false; try { if (string.IsNullOrEmpty(driveLetter) || string.IsNullOrEmpty(fileSystem) || string.IsNullOrEmpty(label)) { EmptyException ex = new EmptyException(); throw ex; } var files = Directory.GetFiles(driveLetter); var directories = Directory.GetDirectories(driveLetter); foreach (var item in files) { try { File.Delete(item); } catch (UnauthorizedAccessException) { } catch (IOException) { } } foreach (var item in directories) { try { Directory.Delete(item); } catch (UnauthorizedAccessException) { } catch (IOException) { } } ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"select * from Win32_Volume WHERE DriveLetter = '" + driveLetter + "'"); foreach (ManagementObject vi in searcher.Get()) { try { var completed = false; var watcher = new ManagementOperationObserver(); watcher.Completed += (sender1, args) => { Console.WriteLine("INFO Errors: " + args.Status); Console.WriteLine("\n"); completed = true; }; vi.InvokeMethod(watcher, "Format", new object[] { fileSystem, quickFormat, clusterSize, label, enableCompression }); while (!completed) { System.Threading.Thread.Sleep(1000); } } catch { ModernDialog.ShowMessage("Something went wrong with partition format. Our apologize.", "Error!", MessageBoxButton.OK); } } txtBlockEnd.Visibility = Visibility.Visible; } catch (EmptyException ex) { ModernDialog.ShowMessage("One of the selected values is invalid. Non of the values can be left empty. \nTry again.", "Error!", MessageBoxButton.OK); } } }