private int warmupRepetitions = 200; //warmup testRepetitions

    #endregion Fields

    #region Constructors

    public TestableFragment(string testDescription, Testable methodToTest, int warmupRepetitions, int testRepetitions)
    {
        this.description = testDescription;
        this.method = methodToTest;
        this.warmupRepetitions = warmupRepetitions;
        this.testRepetitions = testRepetitions;
    }
Пример #2
0
        public void ShouldBuildAnElementFromNothing()
        {
            var elementProvider = new Testable(typeof(NodeProvider<ParentInput>)).Create();

            var node = (NodeElement)elementProvider.Build();

            Assert.That(node.Id, Is.Empty);
            Assert.That(node.Elements["Child"], Is.InstanceOf(typeof(LeafElement)));
        }
Пример #3
0
        public void ShouldBuildAnElementFromInput()
        {
            const string childValue = "Winston";
            var input = new ParentInput { Child = new ChildInput { Value = childValue } };
            var elementProvider = new Testable(typeof(NodeProvider<ParentInput>)).Create();

            var node = (NodeElement)elementProvider.From(input).Build();

            Assert.That(node.Id, Is.Empty);
            var childElement = (LeafElement)node.Elements["Child"];
            Assert.That(childElement.Value, Is.EqualTo(childValue));
        }
Пример #4
0
        public void ShouldBuildAnElementFromErrors()
        {
            var error = new ValidationError("some error");
            var errors = new ValidationErrors<ParentInput>().Add(x => x.Child, error);
            var elementProvider = new Testable(typeof(NodeProvider<ParentInput>)).Create();

            var node = (NodeElement)elementProvider.With(errors).Build();

            Assert.That(node.Id, Is.Empty);
            var childElement = (LeafElement)node.Elements["Child"];
            Assert.That(childElement.Error, Is.EqualTo(error));
        }
 public void it_should_create_the_object_of_the_class()
 {
     var instance = new Testable<Foo, MoqMockFactory>().Instance;
     instance.ShouldNotBeNull();
 }
 public void it_should_create_mock_for_public_property_dependency()
 {
     var instance = new Testable<FooBar, MoqMockFactory>().Instance;
     instance.Bar.ShouldNotBeNull();
 }
 public void it_should_add_1_object_to_the_dependancies_propery_of_the_wrapper()
 {
     var testableClass = new Testable<Baz, MoqMockFactory>();
     testableClass.Dependancies.Count.ShouldEqual(1);
 }
 public void when_no_ctor_defined_it_should_create_instance()
 {
     var instance = new Testable<FooWithoutCtor, MoqMockFactory>().Instance;
     instance.ShouldNotBeNull();
 }
 public virtual void TestFindDouble()
 {
     Assert.AreEqual(Testable.FindDouble("attributedoublep"), double.MinValue);
     Assert.AreEqual(Testable.FindDouble("attributedouble"), 17D);
 }
 public void it_should_fill_foo_property_with_a_user_defined_object()
 {
     var foo = new Foo { TestMessage = "Hello World" };
     var instance = new Testable<Baz, MoqMockFactory>(foo).Instance;
     instance.Foo.ShouldNotBeNull();
     instance.Foo.TestMessage.ShouldEqual("Hello World");
 }
 public void TestFindDictionary()
 {
     Assert.AreEqual(SampleMap, Testable.FindDictionary("attributeMap"));
 }
 public virtual void TestGetUid()
 {
     Assert.AreEqual(Testable.GetUid(), new Uid("UID001"));
 }
 public virtual void TestFindBigDecimal()
 {
     Assert.AreEqual(Testable.FindBigDecimal("attributeBigDecimal"), new BigDecimal(new BigInteger("1"), 0));
 }
 public virtual void FestFindBigInteger()
 {
     Assert.AreEqual(Testable.FindBigInteger("attributeBigInteger"), new BigInteger("1"));
 }
 public virtual void TestFindByteArray()
 {
     Assert.AreEqual(Testable.FindByteArray("attributeByteArray"), System.Text.Encoding.UTF8.GetBytes("array"));
 }
 public virtual void TestFindByte()
 {
     Assert.AreEqual((byte)Testable.FindByte("attributebytep"), (byte)48);
     Assert.AreEqual((byte)Testable.FindByte("attributebyte"), (byte)51);
 }
 public virtual void TestFindFloat()
 {
     Assert.AreEqual(Testable.FindFloat("attributefloatp"), 20F);
     Assert.AreEqual(Testable.FindFloat("attributefloat"), 23F);
 }
 public void it_should_create_the_object_of_type_Foo()
 {
     var instance = new Testable<Foo, MoqMockFactory>().Instance;
     instance.ShouldBeInstanceOf(typeof(Foo));
 }
 public virtual void TestFindInteger()
 {
     Assert.AreEqual((int)Testable.FindInteger("attributeint"), 26);
     Assert.AreEqual((int)Testable.FindInteger("attributeinteger"), 29);
 }
 public void it_should_fill_foo_property_with_a_default_mock_proxy_object()
 {
     var instance = new Testable<Baz, MoqMockFactory>().Instance;
     instance.Foo.ShouldNotBeNull();
     instance.Foo.TestMessage.ShouldBeNull();
 }
Пример #21
0
 public MockTime(Testable.TestableGameObject obj)
     : base(obj)
 {
     DeltaTime = 1.0f;
 }
 public void it_should_have_a_dependency_of_type_IFoo()
 {
     var foo = new Foo { };
     var testableClass = new Testable<Baz, MoqMockFactory>(foo);
     Assert.IsTrue(testableClass.Dependancies.ContainsKey(typeof(IFoo)));
 }
 public virtual void TestFindCharacter()
 {
     Assert.AreEqual((char)Testable.FindCharacter("attributechar"), 'a');
     Assert.AreEqual((char)Testable.FindCharacter("attributecharacter"), 'd');
 }
 public virtual void TestGetName()
 {
     Assert.AreEqual(Testable.GetName(), new Name("NAME001"));
 }
 public virtual void TestFindLong()
 {
     Assert.AreEqual((long)Testable.FindLong("attributelongp"), 11L);
     Assert.AreEqual((long)Testable.FindLong("attributelong"), 14L);
 }
Пример #26
0
 public FakeNavmeshAgent(Testable.TestableGameObject obj)
     : base(obj)
 {
 }
 public virtual void TestGetEnabled()
 {
     Assert.IsFalse(Testable.GetEnabled(true));
 }
 public virtual void TestFindList()
 {
     Assert.AreEqual(Testable.FindList("attributeFloatMultivalue"), CollectionUtil.NewList(new float?[3] {
         24F, 25F, null
     }));
 }
Пример #29
0
        public void testCount()
        {
            Testable t = new Testable();

            Assert.AreEqual(1, t.getCount());
        }