public override void SetUp() { base.SetUp(); vPropDbName = DbName.Vert.Factor.EventorDateTime; vOperation = "lte"; vYear = 2000; vMonth = 1; vDay = 17; vHour = 13; vMinute = 52; vSecond = 3; vValue = DataUtil.EventorTimesToLong(vYear, vMonth, vDay, vHour, vMinute, vSecond); vPropDbNameParam = "_P0"; vValueParam = "_P1"; vScript = ".has(" + vPropDbNameParam + ", Tokens.T.lte, " + vValueParam + ")"; vToType = typeof(FabArtifact); vStep = new TravStepWhereEventorDateTime(); MockItem.Setup(x => x.VerifyParamCount(7, -1)); MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vOperation); MockItem.Setup(x => x.GetParamAt <long>(1)).Returns(vYear); MockItem.Setup(x => x.GetParamAt <byte>(2)).Returns(vMonth); MockItem.Setup(x => x.GetParamAt <byte>(3)).Returns(vDay); MockItem.Setup(x => x.GetParamAt <byte>(4)).Returns(vHour); MockItem.Setup(x => x.GetParamAt <byte>(5)).Returns(vMinute); MockItem.Setup(x => x.GetParamAt <byte>(6)).Returns(vSecond); MockPath.Setup(x => x.AddParam(vPropDbName)).Returns(vPropDbNameParam); MockPath.Setup(x => x.AddParam(vValue)).Returns(vValueParam); MockPath.Setup(x => x.AddScript(vScript)); }
public void ErrorDirectlyAfterAs() { MockPath.Setup(x => x.DoesBackTouchAs(vAlias)).Returns(true); var f = new FabStepFault(FabFault.Code.InvalidStep, 0, "", "", 0); SetupFault(f, "directly after"); CheckConsumePathThrows(f); }
public void ErrorAliasNotFound() { MockPath.Setup(x => x.HasAlias(vAlias)).Returns(false); var f = new FabStepFault(FabFault.Code.IncorrectParamValue, 0, "", "", 0); SetupFault(f, "not be found"); CheckConsumePathThrows(f); }
public void ErrorDuplicateAlias() { MockPath.Setup(x => x.HasAlias(vAlias)).Returns(true); var f = new FabStepFault(FabFault.Code.IncorrectParamValue, 0, "", "", 0); SetupFault(f, "in use"); CheckConsumePathThrows(f); }
public void SucessUpdateValue() { vValue = 123; vStep.UpdateValue = (x => vValue); MockPath.Setup(x => x.AddParam(vValue)).Returns(vValueParam); vStep.ConsumePath(MockPath.Object, GetToType()); CheckSuccess(true); }
public void ErrorNotAllowed() { string confAlias; MockPath.Setup(x => x.AllowBackToAlias(vAlias, out confAlias)).Returns(false); var f = new FabStepFault(FabFault.Code.InvalidStep, 0, "", "", 0); SetupFault(f, "Cannot traverse"); CheckConsumePathThrows(f); }
public void SuccessToLower() { vStep = new TravStepEntryWith <FabTravUserRoot, string, FabUser>("cmd", vPropDbName, true); MockPath.Setup(x => x.AddParam(vValue.ToLower())).Returns(vValueParam); vStep.ConsumePath(MockPath.Object, GetToType()); MockPath.Verify(x => x.AddParam(vValue), Times.Never()); MockPath.Verify(x => x.AddParam(vValue.ToLower()), Times.Once()); }
public void SucessOperations(string pOperation) { vOperation = pOperation; vScript = ".has(" + vPropDbNameParam + ", Tokens.T." + pOperation + ", " + vValueParam + ")"; MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vOperation); MockPath.Setup(x => x.AddScript(vScript)); vStep.ConsumePath(MockPath.Object, GetToType()); CheckSuccess(true); }
public void SuccessNotInVertex() { vScript = "[0..91]"; MockPath.Setup(x => x.AddScript(vScript)); vStep = new TravStepTake <FabFactor, FabArtifact>("cmd", false); vStep.ConsumePath(MockPath.Object, vToType); MockItem.Verify(x => x.VerifyParamCount(1, -1), Times.Once); MockPath.Verify(x => x.AddScript(vScript), Times.Once); }
public void SuccessNotInVertex() { vScript = ".outE(" + vEdgeDbNameParam + ")"; MockPath.Setup(x => x.AddScript(vScript)); vStep = new TravStepLink <FabFactor, FabArtifact>("cmd", vEdgeDbName, false); vStep.ConsumePath(MockPath.Object, vToType); MockItem.Verify(x => x.VerifyParamCount(0, -1), Times.Once); MockPath.Verify(x => x.AddParam(vEdgeDbName), Times.Once); MockPath.Verify(x => x.AddScript(vScript), Times.Once); }
public override void SetUp() { base.SetUp(); vCount = 92; vScript = "[0..91].inV"; vToType = typeof(FabArtifact); vStep = new TravStepTake <FabFactor, FabArtifact>("cmd", true); MockItem.Setup(x => x.VerifyParamCount(1, -1)); MockItem.Setup(x => x.GetParamAt <int>(0)).Returns(vCount); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vEdgeDbName = "edge-name"; vEdgeDbNameParam = "_P0"; vScript = ".outE(" + vEdgeDbNameParam + ").inV"; vToType = typeof(FabArtifact); vStep = new TravStepLink <FabFactor, FabArtifact>("cmd", vEdgeDbName, true); MockItem.Setup(x => x.VerifyParamCount(0, -1)); MockPath.Setup(x => x.AddParam(vEdgeDbName)).Returns(vEdgeDbNameParam); MockPath.Setup(x => x.AddScript(vScript)); }
public void SuccessTypeFilter() { const string typeDbName = DbName.Vert.Vertex.VertexType; const byte typeId = (byte)VertexType.Id.User; const string typeDbNameParam = "_P2"; const string typeIdParam = "_P3"; const string typeScript = ".has(" + typeDbNameParam + ", Tokens.T.eq, " + typeIdParam + ")"; MockPath.Setup(x => x.AddScript(typeScript)); MockPath.Setup(x => x.AddParam(typeDbName)).Returns(typeDbNameParam); MockPath.Setup(x => x.AddParam(typeId)).Returns(typeIdParam); vStep = new TravStepEntryWhere <FabTravVertexRoot, long, FabVertex>("cmd", vPropDbName); vStep.ConsumePath(MockPath.Object, GetToType()); CheckSuccess(true); MockPath.Verify(x => x.AddScript(typeScript), Times.Once); }
public override void SetUp() { base.SetUp(); vAlias = "test"; vAliasParam = "_P0"; vScript = ".as(" + vAliasParam + ")"; vToType = typeof(FabFactor); vStep = new TravStepAs(); MockItem.Setup(x => x.VerifyParamCount(1, -1)); MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vAlias); MockPath.Setup(x => x.HasAlias(vAlias)).Returns(false); MockPath.Setup(x => x.AddAlias(vAlias)); MockPath.Setup(x => x.AddParam(vAlias)).Returns(vAliasParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vVertType = VertexType.Id.Factor; vVertTypeProp = DbName.Vert.Vertex.VertexType; vVertTypePropParam = "_P0"; vVertTypeParam = "_P1"; vScript = ".has(" + vVertTypePropParam + ", Tokens.T.eq, " + vVertTypeParam + ")"; vToType = typeof(FabArtifact); vStep = new TravStepTo <FabFactor, FabArtifact>("cmd", vVertType); MockItem.Setup(x => x.VerifyParamCount(0, -1)); MockPath.Setup(x => x.AddParam(vVertTypeProp)).Returns(vVertTypePropParam); MockPath.Setup(x => x.AddParam(vVertType)).Returns(vVertTypeParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vPropDbName = "my-db-name"; vValue = "contains test"; vPropDbNameParam = "_P0"; vValueParam = "_P1"; vScript = ".has("+vPropDbNameParam+", CONTAINS, "+vValueParam+")"; vToType = typeof(FabArtifact); vStep = new TravStepEntryContains<FabTravArtifactRoot, FabArtifact>("cmd", vPropDbName); MockItem.Setup(x => x.VerifyParamCount(1, -1)); MockItem.Setup(x => x.GetParamAt<string>(0)).Returns(vValue); MockPath.Setup(x => x.AddParam(vPropDbName)).Returns(vPropDbNameParam); MockPath.Setup(x => x.AddParam(vValue)).Returns(vValueParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vMemId = 34223462346; vVertIdProp = DbName.Vert.Vertex.VertexId; vVertIdParam = "_P0"; vMemIdParam = "_P1"; vScript = ".has(" + vVertIdParam + ", " + vMemIdParam + ")"; vToType = typeof(FabMember); vStep = new TravStepActive(); MockItem.Setup(x => x.VerifyParamCount(0, -1)); MockPath.SetupGet(x => x.MemberId).Returns(vMemId); MockPath.Setup(x => x.AddParam(vVertIdProp)).Returns(vVertIdParam); MockPath.Setup(x => x.AddParam(vMemId)).Returns(vMemIdParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vPropDbName = "my-db-name"; vValue = "My Test Value"; vPropDbNameParam = "_P0"; vValueParam = "_P1"; vScript = ".has(" + vPropDbNameParam + ", Tokens.T.eq, " + vValueParam + ")"; vToType = typeof(FabArtifact); vStep = new TravStepWith <FabFactor, string, FabArtifact>("cmd", vPropDbName); MockItem.Setup(x => x.VerifyParamCount(1, -1)); MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vValue); MockPath.Setup(x => x.AddParam(vPropDbName)).Returns(vPropDbNameParam); MockPath.Setup(x => x.AddParam(vValue)).Returns(vValueParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vPropDbName = "my-db-name"; vOperation = "lte"; vValue = 987654; vPropDbNameParam = "_P0"; vValueParam = "_P1"; vScript = ".has(" + vPropDbNameParam + ", LESS_THAN_EQUAL, " + vValueParam + ")"; vToType = typeof(FabUser); vStep = new TravStepEntryWhere <FabTravUserRoot, long, FabUser>("cmd", vPropDbName); MockItem.Setup(x => x.VerifyParamCount(2, -1)); MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vOperation); MockItem.Setup(x => x.GetParamAt <long>(1)).Returns(vValue); MockPath.Setup(x => x.AddParam(vPropDbName)).Returns(vPropDbNameParam); MockPath.Setup(x => x.AddParam(vValue)).Returns(vValueParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vPropDbName = "my-db-name"; vOperation = "lte"; vValue = 987654; vPropDbNameParam = "_P0"; vValueParam = "_P1"; vScript = ".has(" + vPropDbNameParam + ", Tokens.T.lte, " + vValueParam + ")"; vToType = typeof(FabArtifact); vStep = new TravStepWhere <FabFactor, long, FabArtifact>("cmd", vPropDbName); MockItem.Setup(x => x.VerifyParamCount(2, -1)); MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vOperation); MockItem.Setup(x => x.GetParamAt <long>(1)).Returns(vValue); MockPath.Setup(x => x.AddParam(vPropDbName)).Returns(vPropDbNameParam); MockPath.Setup(x => x.AddParam(vValue)).Returns(vValueParam); MockPath.Setup(x => x.AddScript(vScript)); }
public override void SetUp() { base.SetUp(); vAlias = "test"; vAliasParam = "_P0"; vScript = ".back(" + vAliasParam + ")"; vToType = typeof(FabFactor); vStep = new TravStepBack(); string confAlias; MockItem.Setup(x => x.VerifyParamCount(1, -1)); MockItem.Setup(x => x.GetParamAt <string>(0)).Returns(vAlias); MockPath.Setup(x => x.ConsumeSteps(1, typeof(FabElement))).Returns(Items); MockPath.Setup(x => x.HasAlias(vAlias)).Returns(true); MockPath.Setup(x => x.DoesBackTouchAs(vAlias)).Returns(false); MockPath.Setup(x => x.AllowBackToAlias(vAlias, out confAlias)).Returns(true); MockPath.Setup(x => x.AddBackToAlias(vAlias)); MockPath.Setup(x => x.AddParam(vAlias)).Returns(vAliasParam); MockPath.Setup(x => x.AddScript(vScript)); }