/// <summary> /// Parses csv to TestCases /// </summary> /// <param name="data">data parameter</param> /// <param name="resources">resources parameter</param> /// <returns>TestCase list</returns> public static TestCases Parse(List<List<string>> data, ResourceManager resources = null) { if (data == null || !data.Any()) { throw new ArgumentNullException("data"); } var rootHeader = HeaderParser.Parse(data); HeaderValidator.Validate(rootHeader); var cases = new TestCases(); var lastStartIndex = 0; for (var i = HeaderParser.HeaderRowCount; i < data.Count; i++) { var row = data[i]; if (!string.IsNullOrWhiteSpace(row[0])) { if (i != HeaderParser.HeaderRowCount) { cases.Add(TestCaseParser.Parse(rootHeader, data.GetRange(lastStartIndex, i - lastStartIndex), resources)); } lastStartIndex = i; } } cases.Add(TestCaseParser.Parse(rootHeader, data.GetRange(lastStartIndex, data.Count - lastStartIndex), resources)); return cases; }
public async Task TestTestWithNullExpected() { // Arrange var testCases = new TestCases { new TestCase { Arranges = new Arranges { Actual = new Arrange { HttpRequest = new HttpRequest() } }, Assertions = new AssertionList { new StubAssertionBase { Success = true } } }, }; var httpRequestService = new StubIHttpRequestService { GetResponseAsyncHttpRequestActionOfHttpClient = (r, h) => Task.FromResult(new HttpResponse()) }; // Act await testCases.TestAsync(httpRequestService); // Assert Assert.IsTrue(testCases.Success); Assert.AreEqual(0, testCases.FailedCases.Count); Assert.IsNotNull(testCases.ResultMessage); Assert.IsNull(testCases.FailedMessage); }
public static IEnumerable <object[]> ValidValues() { return(TestCases.FromObject( "bar", "barcode", "foo bar", "unbareable ;-)")); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( "foo", "bar", "a", "b")); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( null, new object[] { }, new object[] { null }, new object[] { 1, 2, 3, "foo", "bar" })); }
public static IEnumerable <object?[]> ValidValues() { return(TestCases.FromObject( 101, 1000, 78990, int.MaxValue)); }
public static IEnumerable <object?[]> ValidValues() { return(TestCases.FromObject( "abc", "abcd", "abc abc", "abc lorem ipsum")); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( 9, 11, null, "foo")); }
public static IEnumerable <object[]> NonCanceledTokens() { return(TestCases.FromObject( CancellationToken.None, default(CancellationToken), new CancellationToken(false), NonCanceledSource.Token)); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( new object(), 1, "foo", null)); }
public static IEnumerable <object[]> ValidValues() { return(TestCases.FromObject( new[] { "a", "b", null, "y", "z" }, new List <string> { "a", "b", null, "y", "z" })); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { int selIndex = lstTestCases.SelectedIndex; TestCases.RemoveAt(selIndex); selIndex = Math.Min(TestCases.Count - 1, selIndex); lstTestCases.SelectedIndex = selIndex; }
public IEnumerable <ITestCase> SutHasAppropriateGuards() { var members = this.sutType.GetIdiomaticMembers().Except( this.ExceptToVerifyGuardClause()); return(TestCases.WithArgs(members).WithAuto <GuardClauseAssertion>() .Create((m, a) => a.Verify(m))); }
public static IEnumerable <object?[]> ValidValues() { return(TestCases.FromObject( "comfortable", "portable", "immutable", "lorem ipsum table")); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( new object(), null, new[] { "one", "two" }, new[] { "foo", "bar", "biz" })); }
public static IEnumerable <object[]> ValidValues() { return(TestCases.FromObject( new[] { 1, 2, 3 }, new List <int> { 1, 2, 3 })); }
public static IEnumerable <object[]> InterceptableMethods() { return(TestCases.FromObject( InterceptionTestCase.Create(() => new object().ToString()), InterceptionTestCase.Create(() => ((IBInterface)A.Fake <IAInterface>(builder => builder.Implements(typeof(IBInterface)))) .Method()))); }
public static IEnumerable <object[]> ValidValues() { return(TestCases.FromObject( new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, Enumerable.Range(1, 10))); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, new int[] { }, null, new[] { 1, 2, 3, 4 }, new[] { 9, 8 })); }
public static IEnumerable <object[]> SupportedTypes() { return(TestCases.FromObject( typeof(IInterfaceType), typeof(AbstractClass), typeof(ClassWithProtectedConstructor), typeof(ClassWithInternalConstructor), typeof(InternalType))); }
/// <summary> /// Parses / executes a list of statements. /// </summary> /// <param name="statements"></param> /// <param name="execute"></param> /// <param name="initializer"></param> /// <param name="replaceSemicolonsWithNewLines"></param> protected void InitIntegrationTests(Interpreter i, TestCases testCases) { if (testCases.RequiredTypes != null && testCases.RequiredTypes.Length > 0) { testCases.RequiredTypes.ForEach(type => i.Context.Types.Register(type, null)); } i.Context.Plugins.RegisterAllCustom(); }
public void Test1() { var testCase = new TestCases(); Question2.Logic(testCase); Assert.True(testCase.Output == "-111101110"); }
private static IEnumerable <object?[]> SupportedTypes() { return(TestCases.FromObject( new FakeCreator <IInterfaceType>(), new FakeCreator <AbstractClass>(), new FakeCreator <ClassWithProtectedConstructor>(), new FakeCreator <ClassWithInternalConstructorVisibleToDynamicProxy>(), new FakeCreator <InternalClassVisibleToDynamicProxy>())); }
protected virtual async Task<RunSummary> RunTestCollectionsAsync(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource) { var summary = new RunSummary(); foreach (var collectionGroup in TestCases.Cast<TTestCase>().GroupBy(tc => tc.TestCollection, TestCollectionComparer.Instance)) summary.Aggregate(await RunTestCollectionAsync(messageBus, collectionGroup.Key, collectionGroup, cancellationTokenSource)); return summary; }
public static IEnumerable <object?[]> InvalidValues() { return(TestCases.FromObject( new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, Array.Empty <int>(), (object?)null, new[] { 1, 2, 3, 4 }, new[] { 9, 8 })); }
private void AppendTestCase(TestCase tc) { int index = CalculateNextTestCaseId(); string name = String.Format("TC{0}", index); tc.Name = name; TestCases.Add(tc); tc.DisplayIndex = TestCases.Count; // displayindex includes first column action or condition }
public TestSuite VerifiedSuite() { TestSuite suite = new TestSuite("VerifiedSuite"); TestCase tc = TestCases.Case("Verify that tests returns hello world", new TestDelegate(this.TestReturnHelloWorld), null); VerifiedTestCase vtc = TestCases.Verified(tc, this.helloWorld); suite.Add(vtc); return(suite); }
/// <summary> /// The init. /// </summary> /// <param name="currentcontext"> /// The current context. /// </param> /// <param name="target"> /// The target. /// </param> public override void Init(IContext currentcontext, ITarget target) { base.Init(currentcontext, target); TestCases.Add(new TestCase { TestName = "Possible null injection", InjectionString = TestBaseHelper.LoadTestCase("NullInjectionTester", Context).ToArray() }); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( new[] { "1", "2", "x", "y" }, Array.Empty <string>(), null, new[] { "a", "b", null, "z", "x" }, new[] { "a", "b" })); }
static void Main(string[] args) { TestCases work = new TestCases(); work.Manager(); Console.ReadKey(); work.Close(); Console.ReadKey(); }
public static IEnumerable <object[]> InvalidValues() { return(TestCases.FromObject( null, new object(), Guid.NewGuid(), "FOO", " foo ")); }
internal TestResult Clone() { return(new TestResult( MethodName, Status, ExecutionTime, FailureMessages != null ? FailureMessages.Message : null, FailureMessages != null ? FailureMessages.StackTrace : null, TestCases != null ? TestCases.Select(tc => tc.Clone()).ToList() : null)); }
public async Task TestTestWithFailedCaseHavingException() { // Arrange var exception = fixture.Create<Exception>(); var testCases = new TestCases { new TestCase { Arranges = new Arranges { Expected = new Arrange { HttpRequest = new HttpRequest() }, Actual = new Arrange { HttpRequest = new HttpRequest() } }, Assertions = new AssertionList { new StubAssertionBase { Success = false, Exception = exception }}, }, }; var httpRequestService = new StubIHttpRequestService { GetResponseAsyncHttpRequestActionOfHttpClient = (r, h) => Task.FromResult(new HttpResponse()) }; // Act await testCases.TestAsync(httpRequestService); // Assert Assert.IsFalse(testCases.Success); Assert.AreEqual(1, testCases.FailedCases.Count); Assert.IsNotNull(testCases.ResultMessage); Assert.IsNotNull(testCases.FailedMessage); }