public void OneTestConfigured() { var testSpec = new TestSpec(); var testMethod1 = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Bar")); var testMethod2 = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Nope")); testSpec.AddTest(testMethod1); Assert.True(testSpec.Contains(testMethod1)); Assert.False(testSpec.Contains(testMethod2)); }
public void IgnoredMethod() { MyListener myListener = new MyListener(); TestFixture tc = new TestFixture(typeof(HasIgnoredMethod)); TestSpec ts = new TestSpec(); ts.AddTest("csUnit.Core.Tests", typeof(HasIgnoredMethod).FullName, string.Empty); tc.Execute(ts, myListener); Assert.Equals(1, myListener.SkipCount); // Skipped tests do not 'start' Assert.Equals(1, myListener.TestCount); }
public GapTest() { testSpec = new TestSpec { Stage = 8, TenorWeight = 23, NumRows = 4, ErrorType = 0, ErrorSize = 60, TestBellLoc = 1, SelectedTest = -1 }; screen = new Screen(); }
public void And_AnySpecificationIsNotPersistenceAware_ShouldReturnNotPersistenceAwareSpecification() { //Assert var specification1 = new TestPersistenceAwareSpec <TestEntity>(x => x.A == 1); var specification2 = new TestPersistenceAwareSpec <TestEntity>(x => x.B == 2); var specification3 = new TestSpec <TestEntity>(x => x.B == 2); //Act var combinedSpec = SpecificationLogic.And(specification1, specification2, specification3); //Assert Assert.That(combinedSpec, Is.Not.AssignableTo <PersistenceAndSpecification <TestEntity> >() .And.AssignableTo <Specification <TestEntity> >()); }
public ABTest() { testSpec = new TestSpec { Stage = 8, TenorWeight = 23, NumRows = 4, ErrorType = 1, ErrorSize = 40, TestBellLoc = 0, // Indicates no test bell SelectedTest = -1 }; screenA = new Screen(); screenB = new Screen(); }
public void NameReportedForSkippedMethod() { var fixture = new TestFixture(typeof(FixtureWithIgnoredMethod)); var spec = new TestSpec(); spec.AddTest(new TestMethod(fixture, typeof(FixtureWithIgnoredMethod).GetMethod("ATestMethod"))); spec.AddTest(new TestMethod(fixture, typeof(FixtureWithIgnoredMethod).GetMethod("IgnoredMethodWithReason"))); fixture.Execute(spec, new SimpleTestListener()); Assert.Contains("csUnit.Core.Tests#" + typeof(FixtureWithIgnoredMethod).FullName + "#" + "IgnoredMethodWithReason#TheReason#", SimpleTestListener.IgnoredItems); }
public override void Execute(object sender, EventArgs args) { if (Recipe.Current != null) { TestSpec ts = new TestSpec(); foreach (object item in CommandTarget.SelectedItems) { UiElementInfo uiElemInfo = item as UiElementInfo; if (uiElemInfo != null) { ts.AddTest(uiElemInfo.TestSpecName); } } if (ts.FixtureCount > 0) { Recipe.Current.RunTests(ts); } } }
private void AdvanceToNextPair(TestSpec test) { // Debug.Log("current pair: "+test.leftCardIndex+"/"+test.rightCardIndex+" imageInfo:"+imageInfo.Length); // remove previous pair if (test.leftCardIndex != -1 && test.rightCardIndex != -1) { if (imageInfo[test.leftCardIndex].IsMultiSyllabic()) { multiSyllabicImages.Remove(imageInfo[test.leftCardIndex]); } else { singleSyllabicImages.Remove(imageInfo[test.leftCardIndex]); } if (imageInfo[test.rightCardIndex].IsMultiSyllabic()) { multiSyllabicImages.Remove(imageInfo[test.rightCardIndex]); } else { singleSyllabicImages.Remove(imageInfo[test.rightCardIndex]); } } // TODO: we can infer leftMultiSyllabic using card index var card1 = GetRandomCard(-1, test.leftMultiSyllabic); var card2 = GetRandomCard(card1.index, test.rightMultiSyllabic); card1Texture.mainTexture = card1.texture; card2Texture.mainTexture = emptyCardTexture; test.leftCardIndex = card1.index; test.rightCardIndex = card2.index; test.leftCardTexture = card1.texture; test.rightCardTexture = card2.texture; syllableFields[0].text = ""; syllableFields[1].text = ""; answerField.text = ""; }
public void NoTestConfiguredWhenEmpty() { var testSpec = new TestSpec(); var testMethod = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Bar")); Assert.False(testSpec.Contains(testMethod)); }
public void TestNameIsPrefixOfSecondTestName() { var testSpec = new TestSpec(); var testMethod1 = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Test1")); var testMethod2 = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Test1AsPrefix")); testSpec.AddTest(testMethod1); Assert.True(testSpec.Contains(testMethod1)); Assert.False(testSpec.Contains(testMethod2)); }
public Account() { testSpec = new TestSpec(); }
public Privacy() { testSpec = new TestSpec(); }
public void AddSameTestTwice() { var testSpec = new TestSpec(); var testMethod = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Bar")); testSpec.AddTest(testMethod); testSpec.AddTest(testMethod); Assert.Equals(1, testSpec.FixtureCount); }
public void TestNameIsPrefixOfSecondTestNameViaITestMethod() { var testSpec = new TestSpec(); testSpec.AddTest(GetType().Assembly.GetName().Name, typeof(MockTestMethod).FullName, "Prefix"); Assert.True(testSpec.Contains(new MockTestMethod("Prefix"))); Assert.False(testSpec.Contains(new MockTestMethod("PrefixTestName"))); }
internal void LoadSpec(string inputFileName) { if (Parameters.InputFileName != null) { XmlDocument doc = new XmlDocument(); doc.Load(inputFileName); validator.Validate(doc); XmlSerializer serializer = new XmlSerializer(typeof(TestSpec)); TextReader reader = new StreamReader(inputFileName); TestSpec ts = (TestSpec)serializer.Deserialize(reader); reader.Close(); Parameters.IsAsync = GetContractOption(ts.ServiceContract.IsAsync); Parameters.IsSession = GetContractOption(ts.ServiceContract.IsSession); Parameters.IsOneWay = GetContractOption(ts.ServiceContract.IsOneWay); Parameters.IsCallBack = GetContractOption(ts.ServiceContract.IsCallBack); if (ts.TestDetails.ServerMachineName == null) { Log.Trace("Running both Server and Client on the same machine"); } else { Parameters.ServerMachineName = ts.TestDetails.ServerMachineName; } if (ts.TestDetails.ServerPortNumber == null) { Log.Trace("No port number on the server machine specified"); } else { Parameters.ServerPortNumber = Int32.Parse(ts.TestDetails.ServerPortNumber); } if (ts.TestDetails.ClientCallBackAddress == null) { Log.Trace("No Client CallBack Address specified, using default address for Duplex CallBack contracts if required"); } else { //The ClientBaseAddress specified should be a valid URI try { Parameters.ClientCallBackAddress = new Uri(ts.TestDetails.ClientCallBackAddress); } catch (Exception e) { if (Parameters.IsCallBack != ContractOption.False) { Log.Exception(e); } } } if (ts.TestDetails.ServerTimeout == null) { Log.Trace("Default value used - Server will timeout after 120 seconds"); } else { Parameters.ServerTimeout = new TimeSpan(0, 0, Int32.Parse(ts.TestDetails.ServerTimeout)); } if (ts.TestDetails.ClientTimeout == null) { Log.Trace("Default value used - Client will wait for 30 seconds before starting"); } else { Parameters.ClientTimeout = new TimeSpan(0, 0, Int32.Parse(ts.TestDetails.ClientTimeout)); } if (ts.TestDetails.NumberOfClients == null) { Log.Trace("Default value used - Number of Client per Service = 1"); } else { Parameters.NumberOfClients = Int32.Parse(ts.TestDetails.NumberOfClients); } if (ts.TestDetails.MessagesPerClient == null) { Log.Trace("Default value used - Number of Messages sent per Client = 1"); } else { Parameters.MessagesPerClient = Int32.Parse(ts.TestDetails.MessagesPerClient); } } Log.Trace("ServerMachineName = " + Parameters.ServerMachineName); Log.Trace("ServerPortNumber Number = " + Parameters.ServerPortNumber); if (Parameters.IsCallBack != ContractOption.False) { Log.Trace("ClientCallBack Address = " + Parameters.ClientCallBackAddress.ToString()); } Log.Trace("ServerTimeout = " + Parameters.ServerTimeout.ToString()); Log.Trace("ClientTimeout = " + Parameters.ClientTimeout.ToString()); Log.Trace("NumberOfClients = " + Parameters.NumberOfClients); Log.Trace("MessagesPerClient = " + Parameters.MessagesPerClient); }
public Results() { testSpec = new TestSpec(); }
public Index() { testSpec = new TestSpec(); }
public void CanSelectNameSpace() { var testSpec = new TestSpec(); var nameSpaceName = typeof(MockTestMethod).FullName; var indexOfFirstDot = nameSpaceName.IndexOf('.'); nameSpaceName = nameSpaceName.Substring(0, indexOfFirstDot); testSpec.AddTest(GetType().Assembly.GetName().Name, nameSpaceName, string.Empty); Assert.True(testSpec.Contains(new MockTestMethod("Foo"))); }
public Submissions() { testSpec = new TestSpec(); }
public void IgnoredTestIsNotRun() { var tc = new TestFixture(typeof(Mock2)); var testSpec = new TestSpec(); var t = typeof(Mock2); testSpec.AddTest(t.Assembly.FullName, t.FullName, "IgnoredTest"); tc.Execute(testSpec, new NullListener()); Assert.Equals("FixtureSetUpFixtureTearDown", _methodSequence); }
public void RunTwoOutOfThree() { var tc = new TestFixture(typeof(Mock2)); var testSpec = new TestSpec(); var t = typeof(Mock2); testSpec.AddTest(t.Assembly.FullName, t.FullName, "Test2"); testSpec.AddTest(t.Assembly.FullName, t.FullName, "Test1"); tc.Execute(testSpec, new NullListener()); Assert.Equals("FixtureSetUpSetUpTest1CleanupSetUpTest2CleanupFixtureTearDown", _methodSequence); }
public void RunOneTestOnly() { var testSpec = new TestSpec(); var t = typeof(ClassWithAttributes); testSpec.AddTest(t.Assembly.FullName, t.FullName, "FirstTestMethod"); _tc.Execute(testSpec, new NullListener()); Assert.Equals("SetUpMethodFirstTestMethodCleanupMethod", _methodSequence); }
public void TestNameIsPrefixOfSecondTestName() { var testSpec = new TestSpec(); var testFixture = new TestFixture(typeof(Foo)); var testMethod = new TestMethod(testFixture, typeof(Foo).GetMethod("Test1")); testSpec.AddTest(testMethod); testFixture.Execute(testSpec, new NullListener()); Assert.Equals("Test1()", _methodSequence); }
public void CanSelectTestFixture() { var testSpec = new TestSpec(); testSpec.AddTest(GetType().Assembly.GetName().Name, typeof(MockTestMethod).FullName, string.Empty); Assert.True(testSpec.Contains(new MockTestMethod("Foo"))); }
public void Init(TestSpec spec) { _viewModel.Init(spec); }
private void Test(ControlFlowGraph graph, params string[] lines) { var sequences = graph.DeriveSequences(); Print(sequences); var spec = new TestSpec(); foreach (var line in lines) { spec.ReadLine(line); } spec.Test(graph, sequences); }
public Settings() { testSpec = new TestSpec(); }
public void AssemblyIsConfiguredWithAtLeastOneTest() { var testSpec = new TestSpec(); var testFixture = new TestFixture(typeof(Foo)); var testMethod = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Bar")); testSpec.AddTest(testMethod.AssemblyName, testMethod.DeclaringTypeFullName, testMethod.Name); Assert.True(testSpec.Contains(testFixture)); }