public void MemberTypeDefaultValueTest2() { var target = new MockDataModel(); Assert.AreEqual(target.EntityMappings.FieldMappings["NullableDecimalValue"] .DefaultValue, null); }
public void TargetInfoTest() { var target = new MockDataModel(); Assert.AreEqual(target.EntityMappings.FieldMappings["StringValue"] .ColumnName, "SV"); }
public void TargetInfoTest2() { var target = new MockDataModel(); Assert.AreEqual(target.EntityMappings.FieldMappings["StringValue"] .TargetMemberType, typeof(string)); }
public void LoadDataModelTableMapping_DefaultTableNameTest() { var target = new MockDataModel(); Assert.AreEqual("MockDataModel", target.EntityMappings.TableMapping.Table); Assert.AreEqual("dbo", target.EntityMappings.TableMapping.Schema); }
public void InnerDictionaryTest2() { var target = new MockDataModel(); var value = 3m; target.DecimalValue = value; Assert.AreEqual(value, target.DecimalValue); }
public void InnerDictionaryTest() { var target = new MockDataModel(); var value = "abc"; target.StringValue = value; Assert.AreSame(value, target.StringValue); }
public void ToDataRowTest() { var target = new MockDataModel(); target.StringValue = "abc"; var dr = target.Convert.ToDataRow(); Assert.AreEqual(dr["sv"], "abc"); }
public async Task AddDataMutatorIsCalled() { // arrange var model = new MockDataModel(); _dataMutator.Setup(x => x.BeforeAdd(model, _identity.Object)); // act await _dataContext.Add(model, _identity.Object); // assert _dataMutator.Verify(x => x.BeforeAdd(model, _identity.Object), Times.Once); }
public async Task AddRecordIsSaved() { // arrange var model = new MockDataModel(); _crudDataTools.Setup(x => x.AddModel(model)); // act await _dataContext.Add(model, _identity.Object); // assert _crudDataTools.Verify(x => x.AddModel(model), Times.Once); }
public async Task AddChangeIsBroadcast() { // arrange var model = new MockDataModel(); _changeTracker.Setup(x => x.BroadcastAdd(model, _identity.Object)); // act await _dataContext.Add(model, _identity.Object); // assert _changeTracker.Verify(x => x.BroadcastAdd(model, _identity.Object), Times.Once); }
public void EqualsTest() { var targetA = new MockDataModel(); targetA.StringValue = "xx"; targetA.DecimalValue = 3m; var targetB = new MockDataModel(); targetB.StringValue = "xx"; targetB.DecimalValue = 3m; Assert.IsTrue(targetA.Equals(targetB)); targetB.MarkDeleted = true; Assert.IsFalse(targetA.Equals(targetB)); }
public async Task RemoveRecordIsSaved() { // arrange var oldState = new MockDataModel(); var id = Guid.NewGuid(); _crudDataTools.Setup(x => x.GetModel <MockDataModel>(id)).Returns(Task.FromResult(oldState)); _crudDataTools.Setup(x => x.RemoveModel <MockDataModel>(id)); // act await _dataContext.Remove <MockDataModel>(id, _identity.Object); // assert _crudDataTools.Verify(x => x.GetModel <MockDataModel>(id), Times.Once); }
public async Task ModifyRecordIsSaved() { // arrange var oldState = new MockDataModel(); var newState = new MockDataModel(); _crudDataTools.Setup(x => x.GetModel <MockDataModel>(It.IsAny <Guid>())).Returns(Task.FromResult(oldState)); _crudDataTools.Setup(x => x.ModifyModel(oldState, newState)); // act await _dataContext.Modify(newState, _identity.Object); // assert _crudDataTools.Verify(x => x.ModifyModel(oldState, newState), Times.Once); }
public async Task RemoveChangeIsBroadcast() { // arrange var oldState = new MockDataModel(); var id = Guid.NewGuid(); _crudDataTools.Setup(x => x.GetModel <MockDataModel>(id)).Returns(Task.FromResult(oldState)); _changeTracker.Setup(x => x.BroadcastDelete(oldState, _identity.Object)); // act await _dataContext.Remove <MockDataModel>(id, _identity.Object); // assert _changeTracker.Verify(x => x.BroadcastDelete(oldState, _identity.Object), Times.Once); }
public async Task ModifyChangeIsBroadcast() { // arrange var oldState = new MockDataModel(); var newState = new MockDataModel(); _crudDataTools.Setup(x => x.GetModel <MockDataModel>(It.IsAny <Guid>())).Returns(Task.FromResult(oldState)); ; _changeTracker.Setup(x => x.BroadcastModify(oldState, newState, _identity.Object)); // act await _dataContext.Modify(newState, _identity.Object); // assert _changeTracker.Verify(x => x.BroadcastModify(oldState, newState, _identity.Object), Times.Once); }
public void DataModelFieldMappingAttribute_DefaultNameTest() { var target = new MockDataModel(); Assert.AreEqual(target.EntityMappings.FieldMappings["Field"].ColumnName, "Field"); }