public void StringStartsWithCaseInsensitive() { string expectedValue = "XA"; string actualValue = "xxx"; // MSTest does not support this case. // NUnit Assert.That(actualValue, Does.StartWith(expectedValue).IgnoreCase, () => "Some context"); // Some context // Expected: String starting with "XA", ignoring case // But was: "xxx" // XUnit XUnitAssert.StartsWith(expectedValue, actualValue, StringComparison.CurrentCultureIgnoreCase); // Assert.StartsWith() Failure // Not found: XA // In value: xx... // Fluent actualValue.Should().StartWithEquivalent(expectedValue, "SOME REASONS"); // Expected actualValue to start with equivalent of "XA" because SOME REASONS, but "xxx" differs near "xx" (index 1). // Shouldly actualValue.ShouldStartWith(expectedValue, "Some context"); // actualValue // should start with // "XA" // but was // "xxx" // // Additional Info: // Some context }
public void Camera_Online_Message_Returned_With_Valid_Token_And_Streaming_Camera() { var context = new TestLambdaContext(); var function = new Function(); var cameraStatusConfirmation = function.FunctionHandler(new JObject(), context); Assert.StartsWith($"Camera is online and streaming. Snapshot saved status 200 bucket {config.NestS3Bucket}", cameraStatusConfirmation); }
public async Task Get_SecurePageRequiresAnAuthenticatedUser() { // Act var response = await _client.GetAsync("/admin/products"); // Assert Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); Assert.StartsWith("http://localhost:56272/admin/products", response.Headers.Location.OriginalString); }
public async Task Init() { var chat = this.fixture.GrainFactory.GetGrain <IChatGrain>($"Chatroom-{Guid.NewGuid()}"); var content = (await chat.GetChat()).ToString(); var expectedprefix = "<!--This chat room was created by TestGrains.ChatGrain-->\r\n<root>\r\n <created>"; var expectedsuffix = "</created>\r\n <posts />\r\n</root>"; Assert.StartsWith(expectedprefix, content); Assert.EndsWith(expectedsuffix, content); }
public void StringStartsWith() { string expectedValue = "XX"; string actualValue = "xxx"; // MSTest MSTestStringAssert.StartsWith(actualValue, expectedValue, "Some context"); // StringAssert.StartsWith failed. String 'xxx' does not start with string 'XX'. Some context // NUnit Assert.That(actualValue, Does.StartWith(expectedValue), () => "Some context"); // Some context // Expected: String starting with "XX" // But was: "xxx" // XUnit XUnitAssert.StartsWith(expectedValue, actualValue); // Assert.StartsWith() Failure // Not found: XX // In value: xx... // Fluent actualValue.Should().StartWith(expectedValue, "SOME REASONS"); // Expected actualValue to start with "XX" because SOME REASONS, but "xxx" differs near "xxx" (index 0). // Shouldly actualValue.ShouldStartWith(expectedValue, "Some context", Case.Sensitive); // actualValue // should start with // "XX" // but was // "xxx" // // Additional Info: // Some context }