public void TestProperties_BadPropertySkippedLambda() { var subject = new DummyBadProperty(); var tester = new PropertyTester(subject); tester.AddIgnoredProperty(() => subject.SomeString); tester.TestProperties(); }
public void PropertyTest() { var tester = new PropertyTester(); var env = new TestEnv <Entry <IPropertyable>, IPropertyable>(new Entry <IPropertyable>(tester)); var values1Obs = from gpi in env.Queryable.QueryNotifier <IPropertyable>().SupplyEvent() select new { v1 = gpi.Property1.Value, v2 = gpi.Property2.Value }; var values = values1Obs.FirstAsync().Wait(); Assert.AreEqual(1, values.v1); Assert.AreEqual(2, values.v2); var values2Obs = from gpi in env.Queryable.QueryNotifier <IPropertyable>().SupplyEvent() from v1 in gpi.Property1.PropertyChangeValue() from v2 in gpi.Property2.PropertyChangeValue() select new { v1, v2 }; int[] changes = new int[] { 0, 0 }; values2Obs.Subscribe(o => { changes[0] = o.v1; changes[1] = o.v2; }); tester.Property1.Value = 3; tester.Property2.Value = 4; System.Threading.SpinWait.SpinUntil(() => changes[0] == 3 && changes[1] == 4, 5000); Assert.AreEqual(3, changes[0]); Assert.AreEqual(4, changes[1]); env.Dispose(); }
public void ChecaPropriedades() { var propertyTester = new PropertyTester(new T()); this.IgnorePropertiesOfCollectionType(propertyTester); propertyTester.TestProperties(); }
public void Properties_work() { var tester = new PropertyTester(new TransitionDetails <SaleState, SaleEvent>("test" , new StateDetails <SaleState, SaleEvent>(SaleState.Open) , SaleEvent.AddItem)); tester.TestProperties(); }
private void IgnorePropertiesOfCollectionType(PropertyTester propertyTester) { typeof(T).GetProperties() .Where(x => x.PropertyType == typeof(ICollection <>) == false) .Select(x => x) .ToList() .ForEach(x => propertyTester.IgnoredProperties.Add(x.Name)); }
public void TestProperties_NoEventSkippedLambda() { var subject = new DummyNoEvent(); var tester = new PropertyTester(subject); tester.AddIgnoredProperty(() => subject.SomeInt); tester.TestProperties(); }
public void TestProperties_NoEventSkipped() { var tester = new PropertyTester(new DummyNoEvent()); tester.IgnoredProperties.Add("SomeInt"); tester.TestProperties(); }
public void TestProperties_NoEvent() { var tester = new PropertyTester(new DummyNoEvent()); tester.TestProperties(); }
public void TestProperties_GenericClass() { var tester = new PropertyTester(new DummyGeneric<int, int?, List<string>, string>()); tester.TestProperties(); }
public void TestProperties_CannotGenerateTwoDifferentValues() { var tester = new PropertyTester(new DummyUsesSameEquals()); tester.TestProperties(); }
public void TestProperties_BadPropertySkipped() { var tester = new PropertyTester(new DummyBadProperty()); tester.IgnoredProperties.Add("SomeString"); tester.TestProperties(); }
public void TestProperties_BadProperty() { var tester = new PropertyTester(new DummyBadProperty()); tester.TestProperties(); }
public void TestProperties_UsingMock() { var repository = new MockRepository(); var mock = repository.DynamicMock<IBasicProperties>(); Expect.Call(mock.GetSetProperty).Return("one"); Expect.Call(mock.GetOnlyProperty).Return("anyoldthing"); mock.SetOnlyProperty = "two"; repository.Replay(mock); var typeFactory = new CustomStringTypeFactory(); typeFactory.ReturnValues.Enqueue("one"); typeFactory.ReturnValues.Enqueue("two"); var tester = new PropertyTester(mock, typeFactory); tester.IgnoredProperties.Add("ConstructorArguments"); tester.TestProperties(); repository.Verify(mock); }
public void TestProperties_Self() { var tester = new PropertyTester(new PropertyTester(new object())); tester.TestProperties(); }
public void TestProperties_Pass() { var tester = new PropertyTester(new DummyGood()); tester.TestProperties(); }