Inheritance: TestCase
        public async Task <TestString> Test()
        {
            TestString ts = new TestString();

            ts.MyTestString = "it working";
            return(ts);
        }
Beispiel #2
0
 public void TestUnicode()
 {
     using (var testString = new TestString())
     {
         Assert.That(testString.UnicodeConst, Is.EqualTo("ქართული ენა"));
     }
 }
Beispiel #3
0
        public async Task <ActionResult <TestString> > PostTestString([FromForm] TestString testString)
        {
            _context.TestStrings.Add(testString);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTestString", new { id = testString.Id }, testString));
        }
Beispiel #4
0
        public async Task <IActionResult> PutTestString(long id, TestString testString)
        {
            if (id != testString.Id)
            {
                return(BadRequest());
            }

            _context.Entry(testString).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TestStringExists(id))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (TestNum != 0)
            {
                hash ^= TestNum.GetHashCode();
            }
            if (TestFloat != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(TestFloat);
            }
            if (TestString.Length != 0)
            {
                hash ^= TestString.GetHashCode();
            }
            if (TestBool != false)
            {
                hash ^= TestBool.GetHashCode();
            }
            hash ^= testList_.GetHashCode();
            hash ^= TestDic.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #6
0
        protected override void FillRequiredFields(IsoCountry entity)
        {
            base.FillRequiredFields(entity);
            dynamic obj = entity.AsDynamic();

            obj.CountryAlpha2  = TestString.Substring(0, 2);
            obj.CountryNumeric = TestString;
        }
Beispiel #7
0
        protected override void FillRequiredFields(IsoCurrency entity)
        {
            base.FillRequiredFields(entity);
            dynamic obj = entity.AsDynamic();

            obj.CURRENCYCODE    = TestString.Substring(0, 3);
            obj.CURRENCYNUMERIC = TestString.Substring(0, 3);
        }
Beispiel #8
0
        public void AddColumnSchema(TestString name)
        {
            List <ColumnSchema> columns = _hBase.TableSchema.Columns ?? (_hBase.TableSchema.Columns = new List <ColumnSchema>());

            columns.Add(new ColumnSchema {
                Name = name
            });
        }
            public void Either_Either()
            {
                Assert.True(TestString.TryBoxToResult(typeof(Either <Unit, Either <Unit, string> >), out var boxed));

                var value = Assert.IsType <Either <Unit, Either <Unit, string> > >(boxed);

                Assert.Equal(TestString, value.Right.Right);
            }
            public void Either_Task_ActionResult()
            {
                Assert.True(TestString.TryBoxToResult(typeof(Either <Unit, Task <ActionResult <string> > >), out var boxed));

                var value = Assert.IsType <Either <Unit, Task <ActionResult <string> > > >(boxed);

                Assert.Equal(TestString, value.Right.Result.Value);
            }
            public void Task_Task()
            {
                Assert.True(TestString.TryBoxToResult(typeof(Task <Task <string> >), out var boxed));

                var value = Assert.IsType <Task <Task <string> > >(boxed);

                Assert.Equal(TestString, value.Result.Result);
            }
            public void ActionResult()
            {
                Assert.True(TestString.TryBoxToResult(typeof(ActionResult <string>), out var boxed));

                var value = Assert.IsType <ActionResult <string> >(boxed);

                Assert.Equal(TestString, value.Value);
            }
        public void TestRandom(int textLength, double encodeProbability, double lowerCaseProbability)
        {
            TestString testString    = this.MakeRandom(textLength, encodeProbability, lowerCaseProbability);
            string     decodedString = null;

            Assert.DoesNotThrow(() => decodedString = new QuotedPrintableDecoder(testString.Encoded).GetString());
            Assert.True(testString.Expected.Length == decodedString.Length);
            Assert.True(testString.Expected.Equals(decodedString));
        }
        protected override void FillRequiredFields(BillUserParamsTypeApply entity)
        {
            base.FillRequiredFields(entity);
            dynamic obj = entity.AsDynamic();

            obj.USERPARAMSTYPECODE_R    = BillUserParamsTypeTest.ExistsItem1Code;
            obj.USERPARAMSTYPEAPPLYCODE = TestString.Substring(0, 30);
            obj.USERPARAMSTYPEAPPLYNAME = TestString;
        }
Beispiel #15
0
        protected override void FillRequiredFields(IsoCountry obj)
        {
            base.FillRequiredFields(obj);

            obj.AsDynamic().COUNTRYCODE    = TestString;
            obj.AsDynamic().COUNTRYNAMERUS = TestString;
            obj.AsDynamic().COUNTRYALPHA2  = TestString.Substring(0, 2);
            obj.AsDynamic().COUNTRYNUMERIC = TestString;
        }
Beispiel #16
0
        protected override void FillRequiredFields(Factory entity)
        {
            base.FillRequiredFields(entity);
            dynamic obj = entity.AsDynamic();

            obj.FACTORYCODE = TestString.Substring(0, 3);
            obj.FACTORYNAME = TestString;
            obj.PARTNERID_R = TstMandantId;
        }
Beispiel #17
0
        protected override void FillRequiredFields(IsoCurrency obj)
        {
            base.FillRequiredFields(obj);

            obj.AsDynamic().CURRENCYCODE    = TestString;
            obj.AsDynamic().CURRENCYNAMERUS = TestString;
            //obj.AsDynamic().CURRENCYNUMERIC = TestString;
            obj.AsDynamic().CURRENCYNUMERIC = String.Format("IC{0}", TestString.Substring(Math.Max(0, TestString.Length - 1)));
        }
        public void PrintStringEqual()
        {
            var consoleOutput = new StringWriter();

            Console.SetOut(consoleOutput);
            const string TestString = "This is a test.";

            TestString.Print();
            Assert.Equal(TestString + Environment.NewLine, consoleOutput.ToString());
        }
        public void NotEqualWhenValuesAreDifferent()
        {
            var left  = new TestString("left");
            var right = new TestString("right");

            left.Equals(right as object).Should().BeFalse();
            left.Equals(right).Should().BeFalse();
            (left == right).Should().BeFalse();
            (left != right).Should().BeTrue();
        }
Beispiel #20
0
        public void T01_TestRemoveAndReplace()
        {
            const string TestString = "Hello, world!";

            Assert.AreEqual(TestString, TestString.Replace((char[])null, "foo"));
            Assert.AreEqual(TestString, TestString.Replace(new char[] { 'a', 'b', 'c' }, "foo"));
            Assert.AreEqual("Hellfoo, wfoofoold!", TestString.Replace(new char[] { 'a', 'o', 'c', 'r' }, "foo"));
            Assert.AreEqual("Hellfoo, wfoorld!", TestString.Replace(new char[] { 'o' }, "foo"));
            Assert.AreEqual("Hell, wrld", TestString.Remove('a', 'o', 'b', '!'));
        }
        public void String()
        {
            const string TestString    = "class Test { private string s1 = \" () test  \"; }";
            var          startOfString = TestString.IndexOf('"');
            var          lengthOfStringIncludingQuotes = TestString.LastIndexOf('"') - startOfString + 1;

            AssertExtent(
                TestString,
                pos: startOfString,
                isSignificant: true,
                start: startOfString,
                length: 1
                );

            // Selects whitespace
            AssertExtent(
                TestString,
                pos: startOfString + 1,
                isSignificant: false,
                start: startOfString + 1,
                length: 1
                );

            AssertExtent(
                TestString,
                pos: startOfString + 2,
                isSignificant: true,
                start: startOfString + 2,
                length: 2
                );

            AssertExtent(
                TestString,
                pos: TestString.IndexOf("  \"", StringComparison.Ordinal),
                isSignificant: false,
                start: TestString.IndexOf("  \"", StringComparison.Ordinal),
                length: 2
                );

            AssertExtent(
                TestString,
                pos: TestString.LastIndexOf('"'),
                isSignificant: true,
                start: startOfString + lengthOfStringIncludingQuotes - 1,
                length: 1
                );

            AssertExtent(
                TestString,
                pos: TestString.LastIndexOf('"') + 1,
                isSignificant: true,
                start: TestString.LastIndexOf('"') + 1,
                length: 1
                );
        }
        public void EqualWhenContainingWeirdCharacters()
        {
            var left  = new TestString("Iñtërnâtiônàlizætiøn_𐐒𐐌_あ");
            var right = new TestString("Iñtërnâtiônàlizætiøn_𐐒𐐌_あ");

            left.Equals(right as object).Should().BeTrue();
            left.Equals(right).Should().BeTrue();
            (left == right).Should().BeTrue();
            (left != right).Should().BeFalse();
            left.GetHashCode().Should().Be(right.GetHashCode());
        }
        public void EqualWhenValuesAreEqual()
        {
            var left  = new TestString("Howdy?");
            var right = new TestString("Howdy?");

            left.Equals(right as object).Should().BeTrue();
            left.Equals(right).Should().BeTrue();
            (left == right).Should().BeTrue();
            (left != right).Should().BeFalse();
            left.GetHashCode().Should().Be(right.GetHashCode());
        }
        public void EqualWhenValuesHaveDifferentCasing()
        {
            var left  = new TestString("CASELESS");
            var right = new TestString("CaSeLeSS");

            left.Equals(right as object).Should().BeTrue();
            left.Equals(right).Should().BeTrue();
            (left == right).Should().BeTrue();
            (left != right).Should().BeFalse();
            left.GetHashCode().Should().Be(right.GetHashCode());
        }
Beispiel #25
0
        public async Task <ActionResult <TestString> > PostTestString([FromForm] string data)
        {
            var testString = new TestString {
                Data = data
            };

            _context.TestStrings.Add(testString);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTestString", new { id = testString.Id }, testString));
        }
        public void NotEqualWhenTheOtherIsNull()
        {
            var        left  = new TestString("left");
            TestString?right = null;

            left.Equals(right as object).Should().BeFalse();
            left.Equals(right).Should().BeFalse();
            (left == right).Should().BeFalse();
            (left != right).Should().BeTrue();

            (right == left).Should().BeFalse();
            (right != left).Should().BeTrue();
        }
Beispiel #27
0
        public void TryReadPaddedString_Should_Return_String_Without_Padding()
        {
            const string TestString   = "shoftee";
            string       paddedString = TestString.PadRight(13, '\0');

            var buffer = Encoding.UTF8.GetBytes(paddedString);
            var reader = new PacketReader(buffer);

            string result;

            reader.TryReadPaddedString(13, out result);
            result.Should().Be(TestString);
        }
Beispiel #28
0
        public override Dictionary <string, object> SaveToDict()
        {
            var dict = new Dictionary <string, object>();

            dict.Add(GDMConstants.SchemaKey, "TestSchema");

            dict.Merge(true, TestInt.ToGDEDict(TestIntKey));
            dict.Merge(true, TestString.ToGDEDict(TestStringKey));

            dict.Merge(true, TestList.ToGDEDict(TestListKey));

            dict.Merge(true, TestSchema.ToGDEDict(TestSchemaKey));
            return(dict);
        }
        public void TestAllChars(bool lowerCase)
        {
            // Quoted printable all possible chars
            TestString testString = this.MakeAllEncodeChars(lowerCase);
            string     decoded    = null;

            Assert.DoesNotThrow(() => decoded = new QuotedPrintableDecoder(testString.Encoded).GetString());

            Assert.True(testString.Expected.Length == decoded.Length);
            for (byte i = 0; i < decoded.Length; ++i)
            {
                Assert.True(testString.Expected[i] == decoded[i]);
            }
        }
Beispiel #30
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = TestBoolean.GetHashCode();
         hashCode = (hashCode * 397) ^ TestDouble.GetHashCode();
         hashCode = (hashCode * 397) ^ TestInt;
         hashCode = (hashCode * 397) ^ (TestIntVector != null ? TestIntVector.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TestLong.GetHashCode();
         hashCode = (hashCode * 397) ^ (TestString != null ? TestString.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TestInt128.GetHashCode();
         hashCode = (hashCode * 397) ^ TestInt256.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #31
0
        static void Main(string[] args)
        {
            var x = default (char);

            Console.WriteLine(string.Equals("ṻ", "ǖ", StringComparison.CurrentCulture));
            Console.ReadLine();

            string a = "a" + 8;
            Console.WriteLine(a);

            TestStringImmutable c = new TestStringImmutable();
            c.m1();

            TestString T = new TestString();
            T.m1();
        }
            public void Should_return_HTML_code_representing_a_TextBox_with_its_value_embedded_in_it()
            {
                var test = new TestString("Ginger's House");
                Expression<Func<TestString, string>> metadataFunc = x => x.Value;
                _businessObjectPropertyMetaDataFactory.Expect(x => x.GetFor(metadataFunc)).IgnoreArguments().Return(PropertyMetaDataMocker.CreateStub("Value", false, null, null, null, null, typeof(string)));

                var textBoxData = TextBox.For(test, x => x.Value.ToString(), x => x.Value).WithValidationFrom((Test x) => x.Value);
                textBoxData.ToString().ShouldBeEqualTo("<input type='text' id='value' name='value' class='textbox' value='Ginger&apos;s House'/>");
            }
Beispiel #33
0
 public void TestUnicode()
 {
     using (var testString = new TestString())
     {
         Assert.That(testString.UnicodeConst, Is.EqualTo("ქართული ენა"));
     }
 }