Example #1
0
        void CheckFormat(string formatSpecifier, ValueFormat expectedFormat, int valueInt,
                         string expectedValue)
        {
            var remoteValue           = RemoteValueFakeUtil.CreateSimpleInt("test", valueInt);
            IRemoteValueFormat format = RemoteValueFormatProvider.Get(formatSpecifier);

            Assert.AreEqual(format.FormatValue(remoteValue, ValueFormat.Default), expectedValue);
            Assert.AreEqual(remoteValue.GetFormat(), expectedFormat);
            Assert.IsTrue(format.ShouldInheritFormatSpecifier());
        }
        public void ReturnsError()
        {
            const string errorStr = "error";

            string error       = null;
            var    remoteValue = Substitute.For <RemoteValue>();

            remoteValue.GetPointeeAsByteString(1, Arg.Any <uint>(), out error)
            .Returns(x =>
            {
                x[2] = errorStr;
                return(null);
            });

            IRemoteValueFormat format = RemoteValueFormatProvider.Get("s");

            Assert.AreEqual(errorStr, format.FormatValue(remoteValue, _fallback));
            Assert.IsNull(format.FormatStringView(remoteValue, _fallback));
        }