コード例 #1
0
        //public virtual void Add(PowerUnit com, string name)
        //{
        //    //if (_components.Where(curObj => curObj.Site != null).Any(curObj => curObj.Site.Name.Equals(name)))
        //    //{
        //    //    throw new SystemException("컨테이너에 같은 이름이 존재합니다!");
        //    //}
        //    foreach (var component in _components)
        //    {
        //        var curObj = (PowerUnit)component;
        //        if (curObj.Site != null)
        //        {
        //            if (curObj.Site.Name.Equals(name))
        //                throw new SystemException("컨테이너에 같은 이름이 존재합니다!");
        //        }
        //    }
        //    _components.Add(com);
        //}

        public void Remove(PowerUnit com)
        {
            for (int i = 0; i < Components.Count; ++i)
            {
                if (com.Equals(Components[i]))
                {
                    Components.RemoveAt(i);
                    break;
                }
            }
        }
コード例 #2
0
            public void ParamlessConstructedPowerUnit_ShouldBeEqualToWatt()
            {
                // arrange
                var paramlessConstructedPowerUnit = new PowerUnit();
                var watt = PowerUnit.Watt;

                // act
                // assert
                watt.Equals(paramlessConstructedPowerUnit).Should().BeTrue(because: "'PowerUnit.Watt' should be equal 'new PowerUnit()'");
                paramlessConstructedPowerUnit.Equals(watt).Should().BeTrue(because: "'new PowerUnit()' should be equal 'PowerUnit.Watt'");
            }