public void when_data_contains_query_contains_should_match() { var data = "Foo Bar Baz"; var query = "Bar"; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.Contains(WinINetEvent.Verb, query); Assert.IsTrue(predicate.Test(record)); }
public void when_data_contains_query_but_differs_in_case_contains_should_not_match() { var data = "Foo Bar Baz"; var query = "BAR"; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.Contains(WinINetEvent.Verb, query); Assert.IsFalse(predicate.Test(record)); }
public void when_values_differ_other_than_case_iequals_should_not_match() { var data = "Test"; var query = "Foobar"; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.Is(WinINetEvent.Verb, query); Assert.IsFalse(predicate.Test(record)); }
public void when_values_differ_in_case_iequals_should_match() { var data = "Test"; var query = "TEST"; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.IEquals(WinINetEvent.Verb, query); Assert.IsTrue(predicate.Test(record)); }
public void when_data_does_not_start_with_query_istartswith_should_not_match() { var data = "Foo Bar Baz"; var query = "Bar"; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.IStartsWith(WinINetEvent.Verb, query); Assert.IsFalse(predicate.Test(record)); }
public void when_data_starts_with_query_but_differs_in_case_istartswith_should_match() { var data = "Foo Bar Baz"; var query = "FOO"; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.IStartsWith(WinINetEvent.Verb, query); Assert.IsTrue(predicate.Test(record)); }
public void when_values_are_same_is_should_match() { var data = "Test"; var query = data; var record = WinINetEvent.CreateRecord(String.Empty, data, 0u); var predicate = AnsiString.Is(WinINetEvent.Verb, query); Assert.IsTrue(predicate.Test(record)); }
public void given_invalid_property_name_parse_should_throw() { var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => e.GetAnsiString("InvalidName"); trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, 0u)); }
public void when_requesting_mismatched_type_in_release_it_should_not_throw() { var data = 200u; var prop = WinINetEvent.Status; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => Assert.AreEqual(data, (uint)e.GetInt32(prop)); trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }
public void when_requesting_wrong_size_in_debug_it_should_throw() { var data = 200u; var prop = WinINetEvent.Status; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => Assert.AreEqual(data, e.GetInt16(prop)); trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }
public void given_invalid_type_parse_should_throw() { var data = 200u; var prop = WinINetEvent.Status; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => e.GetInt16(prop); trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }
public void given_type_with_mismatched_size_try_parse_should_return_false() { var data = 200u; var prop = WinINetEvent.Status; short result; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => Assert.IsFalse(e.TryGetInt16(prop, out result)); trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }
public void given_type_with_mismatched_size_parse_default_should_return_default() { var data = 200u; var prop = WinINetEvent.Status; short defVal = 15; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => Assert.AreEqual(defVal, e.GetInt16(prop, defVal)); trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }
public void it_should_parse_ansi_strings() { var data = "http://www.microsoft.com"; var prop = WinINetEvent.URL; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => { Assert.AreEqual(data, e.GetAnsiString(prop)); Assert.AreEqual(data, e.GetAnsiString(prop, String.Empty)); string result; Assert.IsTrue(e.TryGetAnsiString(prop, out result)); Assert.AreEqual(data, result); }; trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( data, String.Empty, 200)); }
public void it_should_parse_uint32() { var data = 200u; var prop = WinINetEvent.Status; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => { Assert.AreEqual(data, e.GetUInt32(prop)); Assert.AreEqual(data, e.GetUInt32(prop, 0u)); uint result; Assert.IsTrue(e.TryGetUInt32(prop, out result)); Assert.AreEqual(data, result); }; trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }
public void it_should_parse_binary() { var data = 0x01020304u; var prop = WinINetEvent.Status; var provider = new Provider(WinINetEvent.ProviderId); provider.OnEvent += e => { byte[] binaryData = e.GetBinary(prop); Assert.AreEqual(sizeof(int), binaryData.Length); Assert.AreEqual(data, BitConverter.ToUInt32(binaryData, 0)); Assert.IsTrue(e.TryGetBinary(prop, out binaryData)); Assert.AreEqual(data, BitConverter.ToUInt32(binaryData, 0)); }; trace.Enable(provider); proxy.PushEvent(WinINetEvent.CreateRecord( String.Empty, String.Empty, data)); }