public void ParsesCorrectlyFromValidString(string s, TmType type) { var result = TmAddr.TryParse(s, out var tmAddr); result.Should().BeTrue(); tmAddr.Should().Be(new TmAddr(type, 16, 33, 257)); }
public void ReturnsCorrectString(TmType type, string expected) { var tmAddr = new TmAddr(type, 16, 33, 257); var result = tmAddr.ToString(); result.Should().Be(expected); }
public void FromTypeChRtuPointCorrectly(TmType type, ushort ch, ushort rtu, ushort point) { var tmAddr = new TmAddr(type, ch, rtu, point); tmAddr.Type.Should().Be(type); tmAddr.Ch.Should().Be(ch); tmAddr.Rtu.Should().Be(rtu); tmAddr.Point.Should().Be(point); }
public void FromStringsWithTypeCorrectly(TmType type, string ch, string rtu, string point) { var tmAddr = TmAddr.Create(type, ch, rtu, point); tmAddr.Type.Should().Be(type); tmAddr.Ch.Should().Be(ushort.Parse(ch)); tmAddr.Rtu.Should().Be(ushort.Parse(rtu)); tmAddr.Point.Should().Be(ushort.Parse(point)); }
public void FromTypeIntegerCorrectly(TmType type, uint value, ushort expectedCh, ushort expectedRtu, ushort expectedPoint) { var tmAddr = new TmAddr(type, value); tmAddr.Type.Should().Be(type); tmAddr.Ch.Should().Be(expectedCh); tmAddr.Rtu.Should().Be(expectedRtu); tmAddr.Point.Should().Be(expectedPoint); }
public static TmNativeDefs.TmDataTypes ToNativeType(this TmType tmType) { switch (tmType) { case TmType.Status: return(TmNativeDefs.TmDataTypes.Status); case TmType.Analog: return(TmNativeDefs.TmDataTypes.Analog); case TmType.Accum: return(TmNativeDefs.TmDataTypes.Accum); case TmType.Channel: return(TmNativeDefs.TmDataTypes.Channel); case TmType.Rtu: return(TmNativeDefs.TmDataTypes.Rtu); case TmType.StatusGroup: return(TmNativeDefs.TmDataTypes.StatusGroup); case TmType.AnalogGroup: return(TmNativeDefs.TmDataTypes.AnalogGroup); case TmType.AccumGroup: return(TmNativeDefs.TmDataTypes.AccumGroup); case TmType.RetroStatus: return(TmNativeDefs.TmDataTypes.RetroStatus); case TmType.RetroAnalog: return(TmNativeDefs.TmDataTypes.RetroAnalog); case TmType.RetroAccum: return(TmNativeDefs.TmDataTypes.RetroAccum); default: return(0); } }
public void ReturnsCorrectTmAddrFromValidString(string s, TmType type) { var tmAddr = TmAddr.Parse(s); tmAddr.Should().Be(new TmAddr(type, 16, 33, 257)); }
public void ReturnsNullFromIncorrectStringsWithType(TmType type, string ch, string rtu, string point) { var tmAddr = TmAddr.Create(type, ch, rtu, point); tmAddr.Should().BeNull(); }