public static Benday.EasyAuthDemo.Api.DomainModels.Lookup CreateModel(
            bool createAsUnsaved = true)
        {
            var fromValue = new Benday.EasyAuthDemo.Api.DomainModels.Lookup();

            fromValue.Id               = UnitTestUtility.GetFakeValueForInt("Id");
            fromValue.DisplayOrder     = UnitTestUtility.GetFakeValueForInt("DisplayOrder");
            fromValue.LookupType       = UnitTestUtility.GetFakeValueForString("LookupType");
            fromValue.LookupKey        = UnitTestUtility.GetFakeValueForString("LookupKey");
            fromValue.LookupValue      = UnitTestUtility.GetFakeValueForString("LookupValue");
            fromValue.Status           = UnitTestUtility.GetFakeValueForString("Status");
            fromValue.CreatedBy        = UnitTestUtility.GetFakeValueForString("CreatedBy");
            fromValue.CreatedDate      = UnitTestUtility.GetFakeValueForDateTime("CreatedDate");
            fromValue.LastModifiedBy   = UnitTestUtility.GetFakeValueForString("LastModifiedBy");
            fromValue.LastModifiedDate = UnitTestUtility.GetFakeValueForDateTime("LastModifiedDate");
            fromValue.Timestamp        = UnitTestUtility.GetFakeValueForByteArray("Timestamp");



            if (createAsUnsaved == true)
            {
                fromValue.Id               = 0;
                fromValue.CreatedDate      = default(DateTime);
                fromValue.LastModifiedDate = default(DateTime);
                fromValue.CreatedBy        = null;
                fromValue.LastModifiedBy   = null;
            }

            return(fromValue);
        }
 public static void AssertAreNotEqual(
     Benday.EasyAuthDemo.WebUi.Models.LookupEditorViewModel expected,
     Benday.EasyAuthDemo.Api.DomainModels.Lookup actual)
 {
     Assert.AreNotEqual <int>(expected.Id, actual.Id,
                              "{0}.AssertAreNotEqual(): Id should not match.",
                              nameof(LookupViewModelTestUtility));
 }
Exemplo n.º 3
0
        public void AdaptLookupFromViewModelToModel()
        {
            // arrange
            var fromValue = LookupViewModelTestUtility.CreateEditorViewModel();
            var toValue   = new Benday.EasyAuthDemo.Api.DomainModels.Lookup();

            // act
            SystemUnderTest.Adapt(fromValue, toValue);

            // assert
            LookupViewModelTestUtility.AssertAreEqual(fromValue, toValue);
        }
 public static void AssertAreEqual(
     Benday.EasyAuthDemo.Api.DataAccess.Entities.LookupEntity expected,
     Benday.EasyAuthDemo.Api.DomainModels.Lookup actual)
 {
     Assert.AreEqual <int>(expected.Id, actual.Id, "Id");
     Assert.AreEqual <int>(expected.DisplayOrder, actual.DisplayOrder, "DisplayOrder");
     Assert.AreEqual <string>(expected.LookupType, actual.LookupType, "LookupType");
     Assert.AreEqual <string>(expected.LookupKey, actual.LookupKey, "LookupKey");
     Assert.AreEqual <string>(expected.LookupValue, actual.LookupValue, "LookupValue");
     Assert.AreEqual <string>(expected.Status, actual.Status, "Status");
     Assert.AreEqual <string>(expected.CreatedBy, actual.CreatedBy, "CreatedBy");
     Assert.AreEqual <DateTime>(expected.CreatedDate, actual.CreatedDate, "CreatedDate");
     Assert.AreEqual <string>(expected.LastModifiedBy, actual.LastModifiedBy, "LastModifiedBy");
     Assert.AreEqual <DateTime>(expected.LastModifiedDate, actual.LastModifiedDate, "LastModifiedDate");
     Assert.AreEqual <byte[]>(expected.Timestamp, actual.Timestamp, "Timestamp");
 }
        public static void ModifyModel(
            Benday.EasyAuthDemo.Api.DomainModels.Lookup fromValue)
        {
            if (fromValue == null)
            {
                throw new ArgumentNullException(nameof(fromValue), $"{nameof(fromValue)} is null.");
            }

            fromValue.DisplayOrder     = UnitTestUtility.GetFakeValueForInt("Modified DisplayOrder");
            fromValue.LookupType       = UnitTestUtility.GetFakeValueForString("Modified LookupType");
            fromValue.LookupKey        = UnitTestUtility.GetFakeValueForString("Modified LookupKey");
            fromValue.LookupValue      = UnitTestUtility.GetFakeValueForString("Modified LookupValue");
            fromValue.Status           = UnitTestUtility.GetFakeValueForString("Modified Status");
            fromValue.CreatedBy        = UnitTestUtility.GetFakeValueForString("Modified CreatedBy");
            fromValue.CreatedDate      = UnitTestUtility.GetFakeValueForDateTime("Modified CreatedDate");
            fromValue.LastModifiedBy   = UnitTestUtility.GetFakeValueForString("Modified LastModifiedBy");
            fromValue.LastModifiedDate = UnitTestUtility.GetFakeValueForDateTime("Modified LastModifiedDate");
            fromValue.Timestamp        = UnitTestUtility.GetFakeValueForByteArray("Modified Timestamp");
        }