Esempio n. 1
0
 public void TestProperties_BadPropertySkippedLambda()
 {
     var subject = new DummyBadProperty();
     var tester = new PropertyTester(subject);
     tester.AddIgnoredProperty(() => subject.SomeString);
     tester.TestProperties();
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public void ChecaPropriedades()
        {
            var propertyTester = new PropertyTester(new T());

            this.IgnorePropertiesOfCollectionType(propertyTester);
            propertyTester.TestProperties();
        }
Esempio n. 4
0
        public void Properties_work()
        {
            var tester = new PropertyTester(new TransitionDetails <SaleState, SaleEvent>("test"
                                                                                         , new StateDetails <SaleState, SaleEvent>(SaleState.Open)
                                                                                         , SaleEvent.AddItem));

            tester.TestProperties();
        }
Esempio n. 5
0
 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));
 }
Esempio n. 6
0
 public void TestProperties_NoEventSkippedLambda()
 {
     var subject = new DummyNoEvent();
     var tester = new PropertyTester(subject);
     tester.AddIgnoredProperty(() => subject.SomeInt);
     tester.TestProperties();
 }
Esempio n. 7
0
 public void TestProperties_NoEventSkipped()
 {
     var tester = new PropertyTester(new DummyNoEvent());
     tester.IgnoredProperties.Add("SomeInt");
     tester.TestProperties();
 }
Esempio n. 8
0
 public void TestProperties_NoEvent()
 {
     var tester = new PropertyTester(new DummyNoEvent());
     tester.TestProperties();
 }
Esempio n. 9
0
 public void TestProperties_GenericClass()
 {
     var tester = new PropertyTester(new DummyGeneric<int, int?, List<string>, string>());
     tester.TestProperties();
 }
Esempio n. 10
0
 public void TestProperties_CannotGenerateTwoDifferentValues()
 {
     var tester = new PropertyTester(new DummyUsesSameEquals());
     tester.TestProperties();
 }
Esempio n. 11
0
 public void TestProperties_BadPropertySkipped()
 {
     var tester = new PropertyTester(new DummyBadProperty());
     tester.IgnoredProperties.Add("SomeString");
     tester.TestProperties();
 }
Esempio n. 12
0
 public void TestProperties_BadProperty()
 {
     var tester = new PropertyTester(new DummyBadProperty());
     tester.TestProperties();
 }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
 public void TestProperties_Self()
 {
     var tester = new PropertyTester(new PropertyTester(new object()));
     tester.TestProperties();
 }
Esempio n. 15
0
 public void TestProperties_Pass()
 {
     var tester = new PropertyTester(new DummyGood());
     tester.TestProperties();
 }