Esempio n. 1
0
 public void IsInitializedAndAccessible()
 {
     var o = new One { TwoP = new TwoProxied() };
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndAccessible(() => o.Two.Three.Four));
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndAccessible(() => o.Two.Three));
     Assert.IsTrue(NHibernateUtilEx.IsInitializedAndAccessible(() => o.Two));
 }
Esempio n. 2
0
 public void IsInitialized()
 {
     var o = new One {TwoP = new TwoProxied()};
     Assert.IsTrue(NHibernateUtilEx.IsInitialized(() => o.Two.Three.Four));
     Assert.IsTrue(o.TwoP.__interceptor.IsUninitialized);
     Assert.IsFalse(NHibernateUtilEx.IsInitialized(() => o.TwoP.Three.Four));
 }
Esempio n. 3
0
        public double ExampleOne()
        {
            var one = new One();
            var two = new Two();

            one = one as Two;
            one = one as One;
            //            two = two as One;     // Not gonna happen

            One var1 = new Two();
            return ((Two) var1).Three;
        }
Esempio n. 4
0
 public void IsInitializedAndNotNull()
 {
     var o = new One { TwoP = new TwoProxied() };
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two.Three.Four));
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two.Three));
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two));
     o.Two = new Two();
     Assert.IsTrue(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two));
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two.Three));
     o.Two.Three = new Three();
     Assert.IsTrue(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two));
     Assert.IsTrue(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two.Three));
     Assert.IsFalse(NHibernateUtilEx.IsInitializedAndNotNull(() => o.Two.Three.Four));
 }
Esempio n. 5
0
        public void _read()
        {
            _code = m_io.ReadU1();
            switch (Code)
            {
            case 1: {
                _data = new One(m_io, this, m_root);
                ((One)(_data))._read();
                break;
            }

            case 2: {
                _data = new Two(m_io, this, m_root);
                ((Two)(_data))._read();
                break;
            }
            }
        }
Esempio n. 6
0
        public virtual void testOneLeaf()
        {
            Identity id = new Identity();
            One     one = new One(logVisitor(id));
            Logger expected = new Logger();
            IVisitable nodeReturned = null;

            try
            {
                nodeReturned = one.visit(n11);
                Assertion.Fail("One(leaf) should fail!");
            }
            catch (VisitFailure)
            {
                Assertion.AssertEquals(expected, logger);
                Assertion.AssertNull(nodeReturned);
            }
        }
Esempio n. 7
0
 public virtual void testOne()
 {
     Identity id = new Identity();
     One     one = new One(logVisitor(id));
     Logger expected = new Logger(id, new IVisitable[]{n1});
     try
     {
         IVisitable nodeReturned = one.visit(n0);
         Assertion.AssertEquals(expected, logger);
         Assertion.AssertEquals(n0, nodeReturned);
     }
     catch (VisitFailure)
     {
         Assertion.AssertEquals(expected, logger);
         //	    assertEquals(n0, nodeReturned);
         Assertion.Fail("VisitFailure should not occur!");
     }
 }
Esempio n. 8
0
    public void Test()
    {
      var one = new One()
      {
        Value1 = 1,
        Value2 = "2",
        Value3 = 3.3,
        Value4 = 4,
        Value5 = 5
      };

      var two = new Another();
      BeanUtils.CopyPropeties(one, two);

      Assert.AreEqual(1, two.Value1);
      Assert.AreEqual("2", two.Value2);
      Assert.AreEqual(3.3, two.Value3);
    }
        public static void Run()
        {
            var one = new One();

            Assert.True(one.Test);

            var two = new Two <object>();

            Assert.True(two.Test);

            var three = new Three();

            Assert.False(three.Test); // => interceptors of base class are private!

            var four = new Four();

            Assert.True(four.Test);

            {
                var five = new Five <string>();

                var strValue = five.StringProp;
                five.StringProp = "asd";

                var intValue = five.IntProp;
                five.IntProp = 123;

                var genericValue = five.GenericProp;
                five.GenericProp = "123";
            }

            {
                var five = new Five <int>();

                var strValue = five.StringProp;
                five.StringProp = "asd";

                var intValue = five.IntProp;
                five.IntProp = 123;

                var genericValue = five.GenericProp;
                five.GenericProp = 123;
            }
        }
Esempio n. 10
0
 public void DenyWriteNavigationPeoperty_AddNew_NavigationCriteria()
 {
     CreateTwoObjects();
     using (DbContextNavigationReferenceObject context = new DbContextNavigationReferenceObject()) {
         context.PermissionsContainer.AddMemberPermission <DbContextNavigationReferenceObject, One>(SecurityOperation.Write, OperationState.Deny, "Reference",
                                                                                                    (s, t) => t.Reference != null && t.Reference.Name == "2");
         One one = context.One.Include(p => p.Reference).First(p => p.Name == "1");
         one.Reference = null;
         context.SaveChanges();
         one.Reference = one;
         context.SaveChanges();
         One one2 = new One()
         {
             Name = "2"
         };
         one.Reference = one2;
         AssertFail(context);
     }
 }
Esempio n. 11
0
        public void StartStopStartStopAndDispose()
        {
            DefaultPicoContainer pico = new DefaultPicoContainer();

            pico.RegisterComponentImplementation(typeof(One));
            pico.RegisterComponentImplementation(typeof(Two));
            pico.RegisterComponentImplementation(typeof(Three));
            pico.RegisterComponentImplementation(typeof(Four));
            One    one = (One)pico.GetComponentInstance(typeof(One));
            object o   = pico.ComponentInstances;

            // instantiation - would be difficult to do these in the wrong order!!
            Assert.AreEqual(4, one.getInstantiating().Count);
            Assert.AreEqual("One", one.getInstantiating()[0]);
            Assert.AreEqual("Two", one.getInstantiating()[1]);
            Assert.AreEqual("Three", one.getInstantiating()[2]);
            Assert.AreEqual("Four", one.getInstantiating()[3]);
            StartStopDisposeLifecycleComps(pico, pico, pico, one);
        }
Esempio n. 12
0
        public static void Dispose()
        {
            GrassTexture.Dispose();
            WaterTexture.Dispose();
            ForestTexture.Dispose();
            HouseTexture.Dispose();
            MountainTexture.Dispose();
            Building.Dispose();

            Zero.Dispose();
            One.Dispose();
            Two.Dispose();
            Three.Dispose();
            Five.Dispose();
            Six.Dispose();
            Eight.Dispose();
            Nine.Dispose();

            Turbine.Dispose();
        }
Esempio n. 13
0
    //public static void CallSaveLoad(MotherBase scene, bool SaveMode, bool AfterBacktoTitle)
    //{
    //  One.SaveMode = SaveMode;
    //  One.AfterBacktoTitle = AfterBacktoTitle;
    //  One.Parent.Add(scene);
    //  One.SaveAndExit = false;
    //  if (scene.Filter != null)
    //  {
    //    scene.Filter.SetActive(true);
    //  }
    //  SceneManager.LoadSceneAsync(Fix.SaveLoad, LoadSceneMode.Additive);
    //}

    public static void CallBattleEnemy(List <string> enemy_list, bool cannot_runaway)
    {
        One.EnemyList.Clear();
        for (int ii = 0; ii < enemy_list.Count; ii++)
        {
            GameObject objEC     = new GameObject("objEC_1");
            Character  character = objEC.AddComponent <Character>();
            character.Construction(enemy_list[ii]);
            One.EnemyList.Add(character);
        }

        for (int ii = 0; ii < One.EnemyList.Count; ii++)
        {
            UnityEngine.Object.DontDestroyOnLoad(One.EnemyList[ii]);
        }
        One.CannotRunAway = cannot_runaway;

        One.StopDungeonMusic();
        SceneManager.LoadSceneAsync("BattleEnemy");
    }
Esempio n. 14
0
        /// <summary>
        /// Input is determined by interface method signature and output is determined by implementing class method signature
        /// </summary>
        public static void Run()
        {
            //contravariance: all One methods can return strings which are valid objects
            //but they cannot take an object parameter from IOne interface because it may not be a valid string
            IOne <object> a = new One <string>();

            //covarince: all Two methods can accept strings arguments declared by ITwo<in T> which are valid objects
            //but they cannot return an object which they declare because it may not be a valid string in ITwo<in T>
            ITwo <string> b = new Two <object>();

            Console.WriteLine("Value: " + a.Get(new Two <object>()));

            var c = new Set <int>((int obj) => { });

            c?.Invoke(5);

            var d = new Get <object>(() => "");

            d?.Invoke();
        }
Esempio n. 15
0
        private void Parse(string[] left)
        {
            One   = left.Where(a => a.Count() == 2).FirstOrDefault();
            Four  = left.Where(a => a.Count() == 4).FirstOrDefault();
            Seven = left.Where(a => a.Count() == 3).FirstOrDefault();
            Eight = "abcdefg";

            //6 parts - 0,6,9
            Six = left.Where(a => a.Count() == 6).Single(a => One.All(b => a.Contains(b)) == false);
            char   rightUp         = Eight.First(a => Six.Contains(a) == false);
            string leftUpAndMiddle = string.Concat(Four.Where(a => One.Contains(a) == false));

            Nine = left.Where(a => a.Count() == 6).First(a => (a.All(b => Six.Contains(b)) == false) && leftUpAndMiddle.All(b => a.Contains(b)));
            Zero = left.Where(a => a.Count() == 6).First(a => (a.All(b => Nine.Contains(b)) == false) && (a.All(b => Six.Contains(b)) == false));

            //5 parts - 2,3,5
            Three = left.Where(a => a.Count() == 5).Single(a => One.All(b => a.Contains(b)));
            Two   = left.Where(a => a.Count() == 5).Single(a => a.Contains(rightUp) && (a.All(b => Three.Contains(b)) == false));
            Five  = left.Where(a => a.Count() == 5).First(a => (a.All(b => Two.Contains(b)) == false) && (a.All(b => Three.Contains(b)) == false));
        }
Esempio n. 16
0
        public static float[,] getControlPointsFor(int start)
        {
            switch (start)
            {
            case (-1):
                return(Null.getInstance().getControlPoints());

            case 0:
                return(Zero.getInstance().getControlPoints());

            case 1:
                return(One.getInstance().getControlPoints());

            case 2:
                return(Two.getInstance().getControlPoints());

            case 3:
                return(Three.getInstance().getControlPoints());

            case 4:
                return(Four.getInstance().getControlPoints());

            case 5:
                return(Five.getInstance().getControlPoints());

            case 6:
                return(Six.getInstance().getControlPoints());

            case 7:
                return(Seven.getInstance().getControlPoints());

            case 8:
                return(Eight.getInstance().getControlPoints());

            case 9:
                return(Nine.getInstance().getControlPoints());

            default:
                throw new ArgumentException("Unsupported number requested");
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Logins the enabled.
        /// </summary>
        /// <param name="databasePath">The database path.</param>
        /// <param name="uid">The uid.</param>
        /// <param name="pwd">The password.</param>
        /// <param name="forgotWord">The forgot word.</param>
        /// <param name="forgotPhrase">The forgot phrase.</param>
        /// <param name="errOut">The error out.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        /// <exception cref="System.Exception"></exception>
        public static bool LoginEnabled(string databasePath, out string uid, out string pwd, out string forgotWord, out string forgotPhrase,
                                        out string errOut)
        {
            bool bAns = false;

            uid          = "admin";
            pwd          = "";
            forgotWord   = "burnsoft";
            forgotPhrase = "The Company that made this App";
            try
            {
                List <OwnerInfo> oi = GetOwnerInfo(databasePath, out errOut);
                if (errOut.Length > 0)
                {
                    throw new Exception(errOut);
                }
                foreach (OwnerInfo o in oi)
                {
                    bAns = o.UsePassword;
                    if (bAns)
                    {
                        uid = One.Decrypt(o.UserName);
                        pwd = One.Decrypt(o.Password);
                        if (o.ForgotPhrase.Length > 0)
                        {
                            forgotPhrase = One.Decrypt(o.ForgotPhrase);
                        }

                        if (o.ForgotWord.Length > 0)
                        {
                            forgotWord = One.Decrypt(o.ForgotWord);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                errOut = ErrorMessage("LoginEnabled", e);
            }
            return(bAns);
        }
Esempio n. 18
0
        static void Main(string[] args)
        {
            try
            {
                One objectOne = new One();
                objectOne.SolutionTaskOne();
                Console.WriteLine();

                Two objectTwo = new Two();
                objectTwo.Answer();
                Console.WriteLine();

                Three objectThree = new Three();
                objectThree.Menu();
                Console.WriteLine();
            }
            catch (Exception)
            {
                Console.WriteLine("НЕПРЕДВИДЕННЫЕ ПРОБЛЕМЫ.");
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public RoulettePlayer() : base()
        {
            // Cash/bets.
            _totalCash = Constants.InitialCashDollars;

            // Chips.
            _selectedChip           = ChipType.Undefined;
            OneChip                 = new One();
            FiveChip                = new Five();
            TwentyFiveChip          = new TwentyFive();
            OneHundredChip          = new OneHundred();
            FiveHundredChip         = new FiveHundred();
            OneThousandChip         = new OneThousand();
            FiveThousandChip        = new FiveThousand();
            TwentyFiveThousandChip  = new TwentyFiveThousand();
            OneHundredThousandChip  = new OneHundredThousand();
            FiveHundredThousandChip = new FiveHundredThousand();

            // Commands.
            ClearBetsCommand = new DelegateCommand(ClearBets).ObservesCanExecute(() => PlaceBets);
        }
Esempio n. 20
0
        /// <summary>
        /// Adds the specified database path.
        /// </summary>
        /// <param name="databasePath">The database path.</param>
        /// <param name="name">The name.</param>
        /// <param name="address">The address.</param>
        /// <param name="city">The city.</param>
        /// <param name="state">The state.</param>
        /// <param name="zip">The zip.</param>
        /// <param name="phone">The phone.</param>
        /// <param name="ccdwl">The CCDWL.</param>
        /// <param name="usePwd">if set to <c>true</c> [use password].</param>
        /// <param name="pwd">The password.</param>
        /// <param name="uid">The uid.</param>
        /// <param name="forgotWord">The forgot word.</param>
        /// <param name="forgotPhrase">The forgot phrase.</param>
        /// <param name="errOut">The error out.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public static bool Add(string databasePath, string name, string address, string city, string state, string zip,
                               string phone, string ccdwl, bool usePwd, string pwd, string uid, string forgotWord, string forgotPhrase,
                               out string errOut)
        {
            bool bAns = false;

            errOut = @"";
            try
            {
                int    iUsePassword = usePwd ? 1 : 0;
                string sql          =
                    $"INSERT INTO Owner_Info(name,address,City,State,Zip,Phone,CCDWL,UsePWD,PWD,UID,forgot_word,forgot_phrase,sync_lastupdate) VALUES('" +
                    $"{name}','{One.Encrypt(address)}','{city}','{state}','{zip}','{phone}','{One.Encrypt(ccdwl)}',{iUsePassword},'{One.Encrypt(pwd)}','{One.Encrypt(uid)}','{One.Encrypt(forgotWord)}','{One.Encrypt(forgotPhrase)}',Now())";
                bAns = Database.Execute(databasePath, sql, out errOut);
            }
            catch (Exception e)
            {
                errOut = ErrorMessage("Add", e);
            }
            return(bAns);
        }
Esempio n. 21
0
        public void LinqClosureDisposesAllAllocatedResourcesOnSelect()
        {
            DummyResource1 resource1    = new("Foo");
            DummyResource2 resource2    = new("Bar");
            DummyResource3 resource3Ref = null;
            DummyResource4 resource4Ref = null;

            string result = from res1 in One.Value(resource1)
                            from res2 in One.Value(resource2)
                            let res3 = resource3Ref = new DummyResource3("Wkwk")
                                                      let res4 = resource4Ref = new DummyResource4("Akwoakoawk")
                                                                                let temp = $"{res3.Text} {res4.Text}"
                                                                                           select $"{res1.Text} {res2.Text} {temp}";

            result.Should().Be("Foo Bar Wkwk Akwoakoawk");

            resource1.Disposed.Should().BeTrue();
            resource2.Disposed.Should().BeTrue();
            resource3Ref.Disposed.Should().BeTrue();
            resource4Ref.Disposed.Should().BeTrue();
        }
Esempio n. 22
0
        public void TestMove()
        {
            One.MoveFirst(1);
            One.MoveLast(1);
            One.MoveFirst(2);
            One.MoveLast(2);

            Two.MoveFirst(1);
            Two.MoveLast(1);
            Two.MoveFirst(2);
            Two.MoveLast(2);

            Two.MoveAfter(1, 2);
            Two.MoveAfter(2, 1);
            Two.MoveBefore(1, 2);
            Two.MoveBefore(2, 1);


            Four.MoveFirst(1).MoveFirst(2).MoveFirst(3).MoveFirst(4).MoveFirst(6);
            Four.MoveFirst(4).MoveFirst(3).MoveFirst(2).MoveFirst(1);
            Four.MoveLast(1).MoveLast(2).MoveLast(3).MoveLast(4).MoveLast(6);
            Four.MoveLast(4).MoveLast(3).MoveLast(2).MoveLast(1);

            Four.MoveBefore(1, 2).MoveBefore(2, 1).MoveBefore(4, 3).MoveBefore(4, 3);
            Four.MoveAfter(1, 2).MoveAfter(2, 1).MoveAfter(4, 3).MoveAfter(4, 3);
            Four.MoveAfter(1, 4);
            Four.MoveAfter(4, 1);
            Four.MoveBefore(4, 1);
            Four.MoveBefore(1, 4);

            Four.MoveAfter(1, 1);
            Four.MoveAfter(4, 4);
            Four.MoveBefore(1, 1);
            Four.MoveBefore(4, 4);

            Four.MoveAfter(1, 6);
            Four.MoveAfter(6, 1);
            Four.MoveBefore(1, 6);
            Four.MoveBefore(6, 1);
        }
Esempio n. 23
0
        /// <summary>
        /// Gets the owner identifier.
        /// </summary>
        /// <param name="databasePath">The database path.</param>
        /// <param name="ownerName">Name of the owner.</param>
        /// <param name="ownerLic">The owner lic.</param>
        /// <param name="sAddress">The s address.</param>
        /// <param name="sCity">The s city.</param>
        /// <param name="sState">State of the s.</param>
        /// <param name="sZip">The s zip.</param>
        /// <param name="sPhone">The s phone.</param>
        /// <param name="errOut">The error out.</param>
        /// <returns>System.Int64.</returns>
        /// <exception cref="System.Exception"></exception>
        public static long GetOwnerId(string databasePath, out string ownerName, out string ownerLic, out string sAddress,
                                      out string sCity, out string sState, out string sZip, out string sPhone, out string errOut)
        {
            long lAns = 0;

            errOut    = "";
            ownerName = "";
            ownerLic  = "";
            sAddress  = "";
            sCity     = "";
            sState    = "";
            sZip      = "";
            sPhone    = "";
            try
            {
                DataTable dt = Database.GetDataFromTable(databasePath, "SELECT TOP 1 * from Owner_Info", out errOut);
                if (errOut.Length > 0)
                {
                    throw new Exception(errOut);
                }
                List <OwnerInfo> lst = GetList(dt, out errOut);

                foreach (OwnerInfo l in lst)
                {
                    lAns      = l.Id;
                    ownerName = l.Name;
                    ownerLic  = One.Decrypt(l.Ccdwl);
                    sAddress  = l.Address;
                    sCity     = l.City;
                    sState    = l.State;
                    sZip      = l.ZipCode;
                    sPhone    = l.Phone;
                }
            }
            catch (Exception e)
            {
                errOut = ErrorMessage("GetOwnerId", e);
            }
            return(lAns);
        }
Esempio n. 24
0
        static void Uri1018(string[] args)
        {
            int N;
            int Change;
            int Hundred, Fifty, Twenty, Ten, Five, Two, One;

            N = int.Parse(Console.ReadLine());

            Change = N;

            Hundred = Change / 100;
            Change  = Change - (Hundred * 100);

            Fifty  = Change / 50;
            Change = Change - (Fifty * 50);

            Twenty = Change / 20;
            Change = Change - (Twenty * 20);

            Ten    = Change / 10;
            Change = Change - (Ten * 10);

            Five   = Change / 5;
            Change = Change - (Five * 5);

            Two    = Change / 2;
            Change = Change - (Two * 2);

            One    = Change / 1;
            Change = Change - (One * 1);

            Console.WriteLine(N.ToString());
            Console.WriteLine(Hundred.ToString() + " nota (s) de R$ 100,00");
            Console.WriteLine(Fifty.ToString() + " nota (s) de R$ 50,00");
            Console.WriteLine(Twenty.ToString() + " nota (s) de R$ 20,00");
            Console.WriteLine(Ten.ToString() + " nota (s) de R$ 10,00");
            Console.WriteLine(Five.ToString() + " nota (s) de R$ 5,00");
            Console.WriteLine(Two.ToString() + " nota (s) de R$ 2,00");
            Console.WriteLine(One.ToString() + " nota (s) de R$ 1,00");
        }
Esempio n. 25
0
        public virtual LBDDNode NOT(LBDDNode f)
        {
            if (f.GetId() == Zero.GetId())
            {
                return(One);
            }
            if (f.GetId() == One.GetId())
            {
                return(Zero);
            }

            if (_notCache.ContainsKey(f.GetId()))
            {
                return(_notCache[f.GetId()]);
            }

            int      v       = f.GetVarId();
            var      invLow  = NOT(f.GetLow());
            var      invHigh = NOT(f.GetHigh());
            LBDDNode node    = null;

            if (f.IsDouble())
            {
                node = MakeOrReturn(v, LBDDNode.Labeling.Double, invHigh, invLow);
            }

            else if (f.IsNegate())
            {
                node = MakeOrReturn(v, LBDDNode.Labeling.Non, invLow, invHigh);
            }

            else /*f.IsNormal()*/
            {
                node = MakeOrReturn(v, LBDDNode.Labeling.Negate, invLow, invHigh);
            }

            _notCache.Add(f.GetId(), node);
            return(node);
        }
Esempio n. 26
0
        static void Main(string[] args)
        {
            One one = delegate(int x)
            {
                return(x);
            };
            Two two = delegate(int y)
            {
                return(y);
            };
            Three three = delegate(int z)
            {
                return(z);
            };
            Random r = new Random();
            var    x = one(r.Next());
            var    y = two(r.Next());
            var    z = three(r.Next());


            int[] array = new int[] { x, y, z };
            for (int i = 0; i < array.Length; i++)
            {
                Console.WriteLine(" Число в массиві " + array[i]);
            }

            Avarage arr = delegate(ref int[] array)
            {
                for (int i = 0; i < array.Length; i++)
                {
                    int avg = (array[i] + array[i + 1] + array[i + 2]) / array.Length;
                    return(avg);
                }
                return(0);
            };
            var avarage = arr(ref array);

            Console.WriteLine("Середнє арифметичне " + avarage);
        }
Esempio n. 27
0
    public void tapButton(Text sender)
    {
        Debug.Log(sender.text);
        //One.SQL.UpdateOwner(Fix.LOG_SAVELOAD_NUMBER, sender.text, String.Empty);
        One.PlaySoundEffect(Fix.SOUND_SELECT_TAP);

        this.txtSender          = sender;
        this.systemMessage.text = MESSAGE_NOWLOADING;
        this.pbSandglass.sprite = this.imageSandglass;

        if (One.SaveMode)
        {
            string targetFileName = String.Empty;
            for (int ii = 0; ii < buttonText.Length; ii++)
            {
                if (this.txtSender.Equals(buttonText[ii]))
                {
                    targetFileName = ((ii + 1) + ((this.pageNumber - 1) * buttonText.Length)).ToString("D3") + "_";
                    break;
                }
            }
            bool result = TryExecSave(this.txtSender, targetFileName);
            if (result == false)
            {
                return;
            }
        }
        else
        {
            if ((this.txtSender).text == String.Empty)
            {
                return;
            }
        }

        this.back_SystemMessage.SetActive(true);
        StartCoroutine(WaitOnly());
    }
Esempio n. 28
0
 public void GetOrAddWithDifferentInstance()
 {
     _itemPolicyMock.Setup(x => x.Create<One>()).Returns(new CacheItemPolicy()).Verifiable();
     var cacher1 = new MemoryCacher<One>(_itemPolicyMock.Object, _objectCacheFactory.Object, typeof (One).Name);
     var cacher2 = new MemoryCacher<One>(_itemPolicyMock.Object, _objectCacheFactory.Object, typeof (One).Name);
     var exp = new One();
     var key = "1sdrsdhsryjtujuw54hrt5nfgmdrhsdr";
     Func<string, One> valueFactory = s =>
     {
         Assert.AreEqual(key, s);
         return exp;
     };
     _objectCacheFactory.Setup(x => x.Create()).Returns(MemoryCache.Default).Verifiable();
     var actual1 = cacher1.GetOrAdd(key, valueFactory);
     var actual2 = cacher2.GetOrAdd(key, s =>
     {
         Assert.Fail("Дважды вызвана фабрика");
         return null;
     });
     Assert.AreEqual(exp, actual1);
     Assert.AreEqual(exp, actual2);
     Assert.AreEqual(actual1, actual2);
 }
		public void Matches()
		{
			SerializablePerson target = new SerializablePerson();
			target.SetAge(27);
			ControlFlowPointcut cflow = new ControlFlowPointcut(typeof(One), "GetAge");
			ProxyFactory factory = new ProxyFactory(target);
			NopInterceptor nop = new NopInterceptor();
			IPerson proxied = (IPerson) factory.GetProxy();
			factory.AddAdvisor(new DefaultPointcutAdvisor(cflow, nop));

			// not advised, not under One...
			Assert.AreEqual(target.GetAge(), proxied.GetAge());
			Assert.AreEqual(0, nop.Count, "Whoops, appear to be advising when not under One's cflow.");

			// will be advised...
			One one = new One();
			Assert.AreEqual(27, one.GetAge(proxied));
			Assert.AreEqual(1, nop.Count, "Not advising when under One's cflow (must be).");

			// won't be advised...
			Assert.AreEqual(target.GetAge(), new One().NoMatch(proxied));
			Assert.AreEqual(1, nop.Count, "Whoops, appear to be advising when under One's cflow scope, BUT NOT under a target method's cflow scope.");
			Assert.AreEqual(3, cflow.EvaluationCount, "Pointcut not invoked the correct number of times.");
		}
Esempio n. 30
0
        // Overload Subtract
        public static Matrix operator -(Matrix One, Matrix Two)
        {
            Matrix Result = new Matrix(                 // New Matrix
                Math.Min(                               // Rows
                    One.GetLength(0),                   // Equal to the
                    Two.GetLength(0)),                  // Smaller of the two
                Math.Min(                               // Columns
                    One.GetLength(1),                   // equal to the
                    Two.GetLength(1)));                 // smaller of the two

            for (int row = 0; row < Math.Min(           // for each row
                     One.GetLength(0),                  // up to the row count
                     Two.GetLength(0)); row++)          // of the smaller matrix
            {
                for (int col = 0; col < Math.Min(       // for each col
                         One.GetLength(1),              // up to the col count
                         Two.GetLength(1)); col++)      // of the smaller matrix
                {
                    Result[row, col] = One[row, col] - Two[row, col];
                }
            }

            return(Result);
        }
Esempio n. 31
0
 private void P1()
 {
     One.Run();
 }
Esempio n. 32
0
        protected virtual void InsertData()
        {
            InMemoryUsers          = new List <User>();
            InMemoryExtraUserInfos = new List <ExtraUserInfo>();
            InMemoryHouses         = new List <House>();

            for (var i = 0; i < 5; i++)
            {
                var house = new House()
                {
                    Address = i + " Road Street, Suburb"
                };
                Database.Insert(house);
                InMemoryHouses.Add(house);
            }

            Database.Insert(new House
            {
                Address = "_ Road\\Street, Suburb"
            }
                            );

            for (var i = 0; i < 15; i++)
            {
                var user = new User
                {
                    Name         = "Name" + (i + 1),
                    Age          = 20 + (i + 1),
                    DateOfBirth  = new DateTime(1970, 1, 1).AddYears(i - 1),
                    Savings      = 50.00m + (1.01m * (i + 1)),
                    IsMale       = (i % 2 == 0),
                    YorN         = (i % 2 == 0) ? 'Y' : 'N',
                    UniqueId     = (i % 2 != 0 ? Guid.NewGuid() : (Guid?)null),
                    TimeSpan     = new TimeSpan(1, 1, 1),
                    House        = i % 2 == 0 ? null : InMemoryHouses[i % 5],
                    SupervisorId = (i + 1) % 2 == 0 ? (i + 1) : (int?)null,
                    Address      = i % 10 == 0 ? null : new Address()
                    {
                        Street = i + " Road Street",
                        City   = "City " + i
                    },
                    TestEnum = (i + 1) % 2 == 0 ? TestEnum.All : TestEnum.None
                };
                Database.Insert(user);
                InMemoryUsers.Add(user);

                var extra = new ExtraUserInfo
                {
                    UserId   = user.UserId,
                    Email    = "email" + (i + 1) + "@email.com",
                    Children = (i + 1)
                };
                Database.Insert(extra);
                InMemoryExtraUserInfos.Add(extra);

                var one = new One()
                {
                    Name = "Name" + (i + 1),
                };
                Database.Insert(one);

                for (int j = 0; j < (i % 3); j++)
                {
                    var many = new Many()
                    {
                        OneId    = one.OneId,
                        Currency = "Cur" + (i + j + 1),
                        Value    = (i + j + 1)
                    };
                    Database.Insert(many);
                }
            }
        }
 public Two(One one)
 {
     one.instantiation("Two");
     this.one = one;
 }
Esempio n. 34
0
        public void TryGetFoundResultTest()
        {
            const string prefix = "123123aawdawdsegsegsegawdf";
            const string key = "321awdawawdasefgsfgsegsegwd";

            var mCache = MemoryCache.Default;
            _objectCacheFactory.Setup(x => x.Create()).Returns(mCache).Verifiable();
            var fullKey = FullKey(prefix, key);
            var exp = new One();
            mCache.Add(fullKey, exp, DateTimeOffset.MaxValue);
            var cacher = new MemoryCacher<One>(_itemPolicyMock.Object, _objectCacheFactory.Object, prefix);
            One actual;
            var tryGetResult = cacher.TryGet(key, out actual);
            Assert.AreEqual(CacheTryGetResult.Found, tryGetResult);
            Assert.AreEqual(exp, actual);
        }
 public Multi(Three three, One one)
 {
     message = "three one";
 }
        public void Container()
        {
            if (!TestDialect.SupportsEmptyInsertsOrHasNonIdentityNativeGenerator)
            {
                Assert.Ignore("Support of empty inserts is required");
            }

            ISession     s = OpenSession();
            ITransaction t = s.BeginTransaction();
            Container    c = new Container();
            Simple       x = new Simple();

            x.Count = 123;
            Simple y = new Simple();

            y.Count = 456;
            s.Save(x, (long)1);
            s.Save(y, (long)0);
            IList <Simple> o2m = new List <Simple>();

            o2m.Add(x);
            o2m.Add(null);
            o2m.Add(y);
            IList <Simple> m2m = new List <Simple>();

            m2m.Add(x);
            m2m.Add(null);
            m2m.Add(y);
            c.OneToMany  = o2m;
            c.ManyToMany = m2m;
            IList <Container.ContainerInnerClass> comps = new List <Container.ContainerInnerClass>();

            Container.ContainerInnerClass ccic = new Container.ContainerInnerClass();
            ccic.Name   = "foo";
            ccic.Simple = x;
            comps.Add(ccic);
            comps.Add(null);
            ccic        = new Container.ContainerInnerClass();
            ccic.Name   = "bar";
            ccic.Simple = y;
            comps.Add(ccic);

            var compos = new HashSet <Container.ContainerInnerClass> {
                ccic
            };

            c.Composites = compos;
            c.Components = comps;
            One  one  = new One();
            Many many = new Many();

            one.Manies = new HashSet <Many> {
                many
            };
            many.One  = one;
            ccic.Many = many;
            ccic.One  = one;
            s.Save(one);
            s.Save(many);
            s.Save(c);
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            c = (Container)s.Load(typeof(Container), c.Id);

            ccic = (Container.ContainerInnerClass)c.Components[2];
            Assert.AreEqual(ccic.One, ccic.Many.One);
            Assert.AreEqual(3, c.Components.Count);
            Assert.AreEqual(1, c.Composites.Count);
            Assert.AreEqual(3, c.OneToMany.Count);
            Assert.AreEqual(3, c.ManyToMany.Count);

            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(c.ManyToMany[i], c.OneToMany[i]);
            }
            Simple o1 = c.OneToMany[0];
            Simple o2 = c.OneToMany[2];

            c.OneToMany.RemoveAt(2);
            c.OneToMany[0] = o2;
            c.OneToMany[1] = o1;
            Container.ContainerInnerClass comp = c.Components[2];
            c.Components.RemoveAt(2);
            c.Components[0] = comp;
            c.ManyToMany[0] = c.ManyToMany[2];
            c.Composites.Add(comp);
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            c = (Container)s.Load(typeof(Container), c.Id);
            Assert.AreEqual(1, c.Components.Count);             //WAS: 2 - h2.0.3 comment
            Assert.AreEqual(2, c.Composites.Count);
            Assert.AreEqual(2, c.OneToMany.Count);
            Assert.AreEqual(3, c.ManyToMany.Count);
            Assert.IsNotNull(c.OneToMany[0]);
            Assert.IsNotNull(c.OneToMany[1]);

            ((Container.ContainerInnerClass)c.Components[0]).Name = "a different name";
            IEnumerator enumer = c.Composites.GetEnumerator();

            enumer.MoveNext();
            ((Container.ContainerInnerClass)enumer.Current).Name = "once again";
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            c = (Container)s.Load(typeof(Container), c.Id);
            Assert.AreEqual(1, c.Components.Count);             //WAS: 2 -> h2.0.3 comment
            Assert.AreEqual(2, c.Composites.Count);
            Assert.AreEqual("a different name", ((Container.ContainerInnerClass)c.Components[0]).Name);
            enumer = c.Composites.GetEnumerator();
            bool found = false;

            while (enumer.MoveNext())
            {
                if (((Container.ContainerInnerClass)enumer.Current).Name.Equals("once again"))
                {
                    found = true;
                }
            }

            Assert.IsTrue(found);
            c.OneToMany.Clear();
            c.ManyToMany.Clear();
            c.Composites.Clear();
            c.Components.Clear();
            s.Delete("from s in class Simple");
            s.Delete("from m in class Many");
            s.Delete("from o in class One");
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            c = (Container)s.Load(typeof(Container), c.Id);
            Assert.AreEqual(0, c.Components.Count);
            Assert.AreEqual(0, c.Composites.Count);
            Assert.AreEqual(0, c.OneToMany.Count);
            Assert.AreEqual(0, c.ManyToMany.Count);
            s.Delete(c);
            t.Commit();
            s.Close();
        }
 public Four(Two two, Three three, One one)
 {
     one.instantiation("Four");
     Assert.IsNotNull(two);
     Assert.IsNotNull(three);
     this.one = one;
 }
Esempio n. 38
0
        public void Test_Mapper()
        {
            var one = new One()
            {
                X1 = "test value",
                X2 = 77,
                X3 = new Two()
                {
                    X11 = new Three()
                    {
                        X21 = 99
                    },
                    X12 = new List<Three>()
                    {
                        new Three(){ X21 = 105 }
                    }
                },
                X4 = new List<Three>()
                {
                    new Three(){X21=203}
                },
                X5 = new Three[]
                {
                    new Three(){X21=204}
                },
                X6 = new Collection<Three>()
                {
                    new Three(){X21=205}
                },
                X7 = new List<Three>()
                {
                    new Three(){X21=206}
                },
                X8 = new Three[]
                {
                    new Three(){X21=207}
                },
                X9 = new Collection<Three>()
                {
                    new Three(){X21=208}
                },
                X10 = new Two()
                {
                    X11 = new Three() { X21 = 301 },
                    X12 = new Collection<Three>() { new Three() { X21 = 401 } }
                }
            };

            var mapper = new Mapper<One, VMOne>().UseMapper<Two, VMTwo>().UseMapper<Three, VMThree>();
            var vmOne = mapper.Map(one);
        }
Esempio n. 39
0
 public void Visit(One one)
 {
     status = "This is class one type";
 }
Esempio n. 40
0
 public void Add(One one)
 {
     Ones.Add(one);
     one.TheRoot = this;
 }
Esempio n. 41
0
        public void RemoveTest()
        {
            const string prefix = "123123af";
            const string key = "321awdaw";

            var mCache = MemoryCache.Default;
            _objectCacheFactory.Setup(x => x.Create()).Returns(mCache).Verifiable();
            var fullKey = FullKey(prefix, key);
            var exp = new One();
            var resExp = mCache.AddOrGetExisting(fullKey, exp, new CacheItemPolicy());
            var actual = mCache.Get(fullKey);
            Assert.IsNull(resExp);
            Assert.AreEqual(exp, actual);

            var cacher = new MemoryCacher<One>(_itemPolicyMock.Object, _objectCacheFactory.Object, prefix);
            cacher.Remove(key);
            var after = mCache.Get(fullKey);
            Assert.IsNull(after);
        }
 public Multi(Two two, One one)
 {
     message = "two one";
 }
 public Multi(One one, Two two)
 {
     message = "one two";
 }
 public Multi(One one, Two two, Three three)
 {
     message = "one two three";
 }
Esempio n. 45
0
 public static void Main ()
 {
         One o = new One ();
 }
Esempio n. 46
0
        static void Main(string[] args)
        {
            One obj = new One();

            obj.add();

            Second Secondobj = new Second();

            Secondobj.Add();
            Secondobj.Min();
            Secondobj.Mutipile();
            Secondobj.Number(25, 25);
            int Sub = Secondobj.Sub();

            Console.WriteLine("Subt is " + Sub);

            GetSetProgram getSetProgram = new GetSetProgram();

            getSetProgram.Pro1 = 10;
            getSetProgram.Pro2 = 20;
            getSetProgram.Display();

            InheritanceChildClass NewChildClassObj = new InheritanceChildClass();

            NewChildClassObj.BaseMethod1();
            NewChildClassObj.BaseMethod2();
            NewChildClassObj.ChildMethod1();
            NewChildClassObj.ChildMethod2();
            NewChildClassObj.MethodOverride();


            Polymorphism NewPolyObj = new Polymorphism();

            NewPolyObj.Display(10);
            NewPolyObj.Display(236.25);
            NewPolyObj.Display("Rahul Bheemanathi");
            NewPolyObj.Display(10, 5);
            NewPolyObj.Display("Honey", "Rahul");

            Abstraction NewAbstractionObj = new Abstraction();

            NewAbstractionObj.add();

            GetSetNumbersOutPut getSetNumbers = new GetSetNumbersOutPut();

            getSetNumbers.PrentClass();
            getSetNumbers.sum(10, 10);
            getSetNumbers.sum(20, 30);

            ReverseNumberProgram reverseNumberProgram = new ReverseNumberProgram();

            reverseNumberProgram.NumberReverse();

            char[] a = new char[] { 'S', 'R', 'I', 'D', 'E', 'V', 'I' };
            ReverseCharactersPrint reverseCharactersPrint = new ReverseCharactersPrint();

            reverseCharactersPrint.ReverseCharacters(a);

            FizzBuzzProgram fizzBuzzProgram = new FizzBuzzProgram();

            fizzBuzzProgram.FizzBuzz();


            Char[]           ReverseChar      = new char[] { 'R', 'A', 'H', 'U', 'L' };
            ReverseWhileLoop reverseWhileLoop = new ReverseWhileLoop();

            reverseWhileLoop.SwapChar(ReverseChar);

            char[] Forward = new char[] { 'R', 'A', 'H', 'U', 'L' };
            FrowardandReverseStringProgram frowardandReverseStringProgram = new FrowardandReverseStringProgram();

            frowardandReverseStringProgram.Forwared(Forward);
            frowardandReverseStringProgram.ReversePrint(Forward);

            //ConstructorProgram Constructor = new ConstructorProgram();
            //ConstructorProgram constructorProgram = new ConstructorProgram("Rahul Bheemanathi");

            //Constructor.add();



            //InheritanceOverride
            CityChildClass cityChildClass = new CityChildClass();
            string         city           = cityChildClass.YourCity();

            Console.WriteLine(city);
            Console.Read();
            Console.ReadKey();

            Console.Read();
        }
Esempio n. 47
0
        private void Calcolator_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            string chiave = e.Text;

            switch (chiave)
            {
            case "1": One.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));     // a sort of PerformClick()
                break;

            case "2": two.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "3": three.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "4": four.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "5": five.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "6": six.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "7": seven.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "8": eight.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "9": nine.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "0": zero.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case ",": dot.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "-": minus.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "+": plus.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "*": per.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "/": div.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "c": clear.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case ".": dot.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            case "=": result.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                break;

            default: return;
            }
        }
Esempio n. 48
0
        public void OneCanBeCreatedUsingFactory()
        {
            One <string> oneString = One.Value("Hello world");

            oneString.Value.Should().Be("Hello world");
        }
Esempio n. 49
0
        /// <summary>
        /// Updates the specified database path.
        /// </summary>
        /// <param name="databasePath">The database path.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="address">The address.</param>
        /// <param name="city">The city.</param>
        /// <param name="state">The state.</param>
        /// <param name="zip">The zip.</param>
        /// <param name="phone">The phone.</param>
        /// <param name="ccdwl">The CCDWL.</param>
        /// <param name="usePwd">if set to <c>true</c> [use password].</param>
        /// <param name="pwd">The password.</param>
        /// <param name="uid">The uid.</param>
        /// <param name="forgotWord">The forgot word.</param>
        /// <param name="forgotPhrase">The forgot phrase.</param>
        /// <param name="errOut">The error out.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public static bool Update(string databasePath, long id, string name, string address, string city, string state, string zip,
                                  string phone, string ccdwl, bool usePwd, string pwd, string uid, string forgotWord, string forgotPhrase,
                                  out string errOut)
        {
            bool bAns = false;

            errOut = @"";
            try
            {
                if (id == 0)
                {
                    bAns = Add(databasePath, name, address, city, state, zip, phone, ccdwl, usePwd, pwd, uid,
                               forgotWord, forgotPhrase, out errOut);
                }
                else
                {
                    int    iUsePassword = usePwd ? 1 : 0;
                    string sql          =
                        $"UPDATE Owner_Info set name='{name}',address='{One.Encrypt(address)}',City='{city}',State='{state}',Zip='{zip}',Phone='{phone}'" +
                        $",CCDWL='{One.Encrypt(ccdwl)}',UsePWD={iUsePassword},PWD='{One.Encrypt(pwd)}',UID='{One.Encrypt(uid)}',forgot_word='{One.Encrypt(forgotWord)}',forgot_phrase='{One.Encrypt(forgotPhrase)}'" +
                        $",sync_lastupdate=Now() where id={id}";
                    bAns = Database.Execute(databasePath, sql, out errOut);
                }
            }
            catch (Exception e)
            {
                errOut = ErrorMessage("Update", e);
            }
            return(bAns);
        }
Esempio n. 50
0
        public void OneCanBeImplicitlyCastIntoValue()
        {
            int intValue = One.Value(1234);

            intValue.Should().Be(1234);
        }
 public Three(One one, Two two)
 {
     one.instantiation("Three");
     Assert.IsNotNull(two);
     this.one = one;
 }
Esempio n. 52
0
        protected void InsertData()
        {
            InMemoryUsers            = new List <UserDecorated>();
            InMemoryExtraUserInfos   = new List <ExtraUserInfoDecorated>();
            InMemoryCompositeObjects = new List <CompositeObjectDecorated>();
            InMemoryHouses           = new List <HouseDecorated>();

            for (var i = 0; i < 5; i++)
            {
                var house = new HouseDecorated()
                {
                    Address = i + " Road Street, Suburb"
                };
                Database.Insert(house);
                InMemoryHouses.Add(house);
            }

            for (var i = 0; i < 15; i++)
            {
                var pos = i + 1;

                var user = new UserDecorated
                {
                    Name        = "Name" + (i + 1),
                    Age         = 20 + (i + 1),
                    DateOfBirth = new DateTime(1970, 1, 1).AddYears(i + 1),
                    Savings     = 50.00m + (1.01m * (i + 1)),
                    IsMale      = (i % 2 == 0),
                    HouseId     = i % 2 == 0 ? (int?)null : InMemoryHouses[i % 5].HouseId
                };
                Database.Insert(user);
                InMemoryUsers.Add(user);

                var extra = new ExtraUserInfoDecorated
                {
                    UserId   = user.UserId,
                    Email    = "email" + (i + 1) + "@email.com",
                    Children = (i + 1)
                };
                Database.Insert(extra);
                InMemoryExtraUserInfos.Add(extra);

                var composite = new CompositeObjectDecorated
                {
                    Key1ID      = pos,
                    Key2ID      = i + 2,
                    Key3ID      = i + 4,
                    TextData    = "This is some text data.",
                    DateEntered = DateTime.Now
                };
                Database.Insert(composite);
                InMemoryCompositeObjects.Add(composite);

                var recursionUser = new RecursionUser
                {
                    Name      = "Name" + (i + 1),
                    CreatedBy = new RecursionUser()
                    {
                        Id = 1
                    },
                    Supervisor = new RecursionUser()
                    {
                        Id = 2
                    }
                };
                Database.Insert(recursionUser);

                var one = new One()
                {
                    Name = "Name" + (i + 1),
                };
                Database.Insert(one);

                for (int j = 0; j < (i % 3); j++)
                {
                    var many = new Many()
                    {
                        OneId    = one.OneId,
                        Currency = "Cur" + (i + j + 1),
                        AValue   = (i + j + 1)
                    };
                    Database.Insert(many);
                }

                var userWithAddress = new UserWithAddress()
                {
                    Name    = "Name" + (i + 1),
                    Address = new UserWithAddress.MyAddress()
                    {
                        StreetNo           = i + 1,
                        StreetName         = "Street" + (i + 1),
                        MovedInOn          = new DateTime(1970, 1, 1).AddYears(i + 1),
                        AddressFurtherInfo = new UserWithAddress.MyAddress.AddressInfo()
                        {
                            PostCode = "99999"
                        }
                    }
                };

                Database.Insert(userWithAddress);
            }

            // Verify DB record counts
            var userCount = Database.ExecuteScalar <int>("SELECT COUNT(UserId) FROM Users");

            Assert.AreEqual(InMemoryUsers.Count, userCount, "Test User Data not in sync db has " + userCount + " records, but the in memory copy has only " + InMemoryUsers.Count + " records.");
            System.Diagnostics.Debug.WriteLine("Created " + userCount + " test users for the unit tests.");

            var userExtraInfoCount = Database.ExecuteScalar <int>("SELECT COUNT(ExtraUserInfoId) FROM ExtraUserInfos");

            Assert.AreEqual(InMemoryExtraUserInfos.Count, userExtraInfoCount, "Test User Extra Info Data not in sync db has " + userExtraInfoCount + " records, but the in memory copy has only " + InMemoryExtraUserInfos.Count + " records.");
            System.Diagnostics.Debug.WriteLine("Created " + userExtraInfoCount + " test extra user info records for the unit tests.");

            var compositeObjectCount = Database.ExecuteScalar <int>("SELECT COUNT(Key1_ID) FROM CompositeObjects");

            Assert.AreEqual(InMemoryCompositeObjects.Count, compositeObjectCount, "Test Composite Object Data not in sync db has " + compositeObjectCount + " records, but the in memory copy has only " + InMemoryCompositeObjects.Count + " records.");
            System.Diagnostics.Debug.WriteLine("Created " + compositeObjectCount + " test composite PK objects for the unit tests.");
        }
        private void StartStopDisposeLifecycleComps(IStartable start, IStartable stop, IDisposable disp, One one)
        {
            start.Start();

            // post instantiation startup
            Assert.AreEqual(4, one.getStarting().Count);
            Assert.AreEqual("One", one.getStarting()[0]);
            Assert.AreEqual("Two", one.getStarting()[1]);
            Assert.AreEqual("Three", one.getStarting()[2]);
            Assert.AreEqual("Four", one.getStarting()[3]);

            stop.Stop();

            // post instantiation shutdown - REVERSE order.
            Assert.AreEqual(4, one.getStopping().Count);
            Assert.AreEqual("Four", one.getStopping()[0]);
            Assert.AreEqual("Three", one.getStopping()[1]);
            Assert.AreEqual("Two", one.getStopping()[2]);
            Assert.AreEqual("One", one.getStopping()[3]);

            disp.Dispose();

            // post instantiation shutdown - REVERSE order.
            Assert.AreEqual(4, one.getDisposing().Count);
            Assert.AreEqual("Four", one.getDisposing()[0]);
            Assert.AreEqual("Three", one.getDisposing()[1]);
            Assert.AreEqual("Two", one.getDisposing()[2]);
            Assert.AreEqual("One", one.getDisposing()[3]);
        }
 public ClassTwo(ITest1 test1, One one)
 {
     m_Itest1 = test1;
     m_One = one;
 }