static void Main(string[] args)
    {
        IBackend addon = new FooA();

        Console.WriteLine("Enter something if you like");
        var more   = Console.ReadLine();
        var result = Runtime(addon);

        Console.WriteLine("Result: {0}", result ?? "No Output :o(");
    }
        public void ReadExistingObjectSuccessfullTest()
        {
            var materializer   = CreateMaterializer();
            var serializer     = JsonSerializer.Create();
            var reader         = new JsonTextReader(new StringReader(@"{ ""intValue"": 123 }"));
            var existingObject = new FooA();
            var newObject      = materializer.ReadJson(reader, typeof(FooA), existingObject, serializer);

            Assert.Same(existingObject, newObject);
            Assert.Equal(123, existingObject.IntValue);
        }
        public void Can_consistently_serialize_stream()
        {
            var item    = new FooA();
            var result1 = SerializeToStream1(item);
            var result2 = SerializeToStream2(item);
            var result3 = SerializeToStream1(item);
            var result4 = SerializeToStream2(item);

            Assert.That(result1, Is.EqualTo(result2));
            Assert.That(result3, Is.EqualTo(result4));
        }
示例#4
0
		public void Test_Validate()
		{
			try
			{
				var foo = new FooA() {Name = "Bethany"};
				var validator = new DomainObjectValidator();
				validator.Validate(foo);

				Assert.Fail("expected validation failure");
			}
			catch (EntityValidationException e)
			{
				// exactly one broken rule
				Assert.AreEqual(1, e.Reasons.Length);
			}
		}
示例#5
0
        public void Test_LengthSpecification()
        {
            var builder = new ValidationBuilder(typeof(FooA));
            var ruleSet = builder.LowLevelRules;

            Assert.AreEqual(1, ruleSet.Rules.Count);
            object rule = ruleSet.Rules[0];

            Assert.IsInstanceOf <LengthSpecification>(rule);
            var property = CollectionUtils.FirstElement((rule as IPropertyBoundRule).Properties);

            Assert.AreEqual(typeof(FooA).GetProperty("Name"), property);

            var fooA = new FooA {
                Name = "Bob"
            };

            Assert.IsTrue(ruleSet.Test(fooA).Success);

            fooA.Name = "Robert";

            Assert.IsFalse(ruleSet.Test(fooA).Success);
        }
 private void Test()
 {
     var fooA = new FooA();
 }
		public void Test_LengthSpecification()
		{
			var builder = new ValidationBuilder(typeof(FooA));
			var ruleSet = builder.LowLevelRules;

			Assert.AreEqual(1, ruleSet.Rules.Count);
			object rule = ruleSet.Rules[0];
			Assert.IsInstanceOf<LengthSpecification>(rule);
			var property = CollectionUtils.FirstElement((rule as IPropertyBoundRule).Properties);
			Assert.AreEqual(typeof(FooA).GetProperty("Name"), property);

			var fooA = new FooA {Name = "Bob"};

			Assert.IsTrue(ruleSet.Test(fooA).Success);

			fooA.Name = "Robert";

			Assert.IsFalse(ruleSet.Test(fooA).Success);
		}
示例#8
0
文件: bar.cs 项目: mono/gert
	public void Run ()
	{
		foo = new FooA ();
		if (foo == null) {
		}
	}
 public void CanAccessFooA(FooA a)
 {
     a.PropertyA = "See, I can access this here";
 }
 public ConstructorDependency(FooA fooA)
 {
     _fooA = fooA;
 }
示例#11
0
 public static int M3A(this FooA foo, int x)
 {
     return(x);
 }
示例#12
0
 public static void M2A(this FooA foo, string name)
 {
 }
示例#13
0
 public static void M1A(this FooA foo)
 {
 }
		public void Test_Validate()
		{
			try
			{
				var foo = new FooA() {Name = "Bethany"};
				var validator = new DomainObjectValidator();
				validator.Validate(foo);

				Assert.Fail("expected validation failure");
			}
			catch (EntityValidationException e)
			{
				// exactly one broken rule
				Assert.AreEqual(1, e.Reasons.Length);
			}
		}
 public FooB(FooA a)
 {
     // Pass instance of FooA to constructor
     // (inject dependency) and store as a member variable
     this._a = a;
 }
示例#16
0
 public ConstructorDependencyOnModel(FooA fooA, Model model)
 {
     _fooA = fooA;
 }
 public FooProxy(FooA a, FooB b)
 {
     this.a = a;
     this.b = b;
 }
示例#18
0
 public static void DoSomething()
 {
     var foo  = new Foo();
     var fooA = new FooA();
 }