public void TestToString()
 {
     _sample = new StringAggregateRootSample {
         Name = "a"
     };
     Assert.Equal(string.Format("Id:{0},姓名:a", _sample.Id), _sample.ToString());
 }
Example #2
0
 public void Test_ToString()
 {
     _sample = new StringAggregateRootSample {
         Name = "a"
     };
     Assert.Equal($"Id:{_sample.Id},姓名:a", _sample.ToString());
 }
 public void TestEquals_IdEquals()
 {
     _sample  = new StringAggregateRootSample("a");
     _sample2 = new StringAggregateRootSample("a");
     Assert.True(_sample.Equals(_sample2));
     Assert.True(_sample == _sample2);
     Assert.False(_sample != _sample2);
 }
 public void TestValidate_IdIsEmpty()
 {
     AssertHelper.Throws <Warning>(() => {
         _sample = new StringAggregateRootSample(null);
         _sample.Validate();
     }, "Id");
     AssertHelper.Throws <Warning>(() => {
         _sample = new StringAggregateRootSample("");
         _sample.Validate();
     }, "Id");
 }
        public void TestEquals_Id_Null()
        {
            _sample  = new StringAggregateRootSample(null);
            _sample2 = new StringAggregateRootSample("a");
            Assert.False(_sample.Equals(_sample2));
            Assert.False(_sample == _sample2);
            Assert.False(_sample2 == _sample);

            _sample  = new StringAggregateRootSample("a");
            _sample2 = new StringAggregateRootSample(null);
            Assert.False(_sample.Equals(_sample2));
            Assert.False(_sample == _sample2);
            Assert.False(_sample2 == _sample);
        }
 /// <summary>
 /// 测试初始化
 /// </summary>
 public StringEntityTest()
 {
     _sample  = new StringAggregateRootSample();
     _sample2 = new StringAggregateRootSample();
 }
Example #7
0
 public void Test_Equals_IdEquals()
 {
     _sample  = new StringAggregateRootSample("a");
     _sample2 = new StringAggregateRootSample("a");
 }