コード例 #1
0
        public void ShortestShouldReturnShortestString()
        {
            var seq = new StringSequence();

            seq.Add("a");
            seq.Add("b");
            seq.Add("c");
            Assert.Equal("a", seq.Shortest(seq));
        }
コード例 #2
0
        public void AddshouldAddInConsistentOrder()
        {
            var seq = new StringSequence();

            seq.Add("abc");
            seq.Add("def");
            Assert.Equal(expected: "abc", actual: seq[0]);
            Assert.Equal(expected: "def", actual: seq[1]);
        }
コード例 #3
0
        public void LongestStringShouldReturnLongest()
        {
            var seq = new StringSequence();

            seq.Add("");
            seq.Add("abc");
            seq.Add("0918034");

            var longest = seq.LongestString();

            Assert.Equal("0918034", longest);
        }
コード例 #4
0
        public void ShortestStringShouldReturnShortest()
        {
            var seq = new StringSequence();

            seq.Add("Helloooooooo");
            seq.Add("");
            seq.Add("asdf");
            seq.Add("v");

            var shortest = seq.ShortestString();

            Assert.Equal("", shortest);
        }
コード例 #5
0
        public void AddShouldAddInConsistenOrder()
        {
            //Arrange ---- any set up necessary to prepare for the behavior to test
            var seq = new StringSequence();

            //Act ---- Do The Thing You Want To Test
            seq.Add("abc");
            seq.Add("def");

            //Assert ---- Verify That Behaviour was as Expected
            Assert.Equal(expected: "abc", actual: seq[0]);
            Assert.Equal(expected: "def", actual: seq[1]);
        }
コード例 #6
0
        public void AddShouldAdd()
        {
            //arrange (any setup neccesary to prepare for the behavior to test)
            var seq = new StringSequence();

            //act (do the thing you want to test)
            seq.Add("abc");
            seq.Add("def");

            //assert (verify that the behavior was as expected)
            Assert.Equal(expected: "abc", actual: seq[0]);
            Assert.Equal(expected: "def", actual: seq[1]);
        }
コード例 #7
0
        public void  IfColtonsNameIsOnTheListShouldReturnTrue()
        {
            //arrange
            var seq = new StringSequence();

            seq.Add("other name");
            seq.Add("another name");
            seq.Add("Colton");
            //act
            var MyName = seq.AmIOnTheList();

            //assert
            Assert.True(MyName);
        }
コード例 #8
0
        public void LongestStringShouldReturnLongest()
        {
            //arrange
            var seq = new StringSequence();

            seq.Add("");
            seq.Add("abc");
            seq.Add("023456789");

            //act
            var longest = seq.LongestString();

            //assert
            Assert.Equal("0123456789", longest);
        }
コード例 #9
0
        public void AddShouldAdd(string item)
        {
            var seq = new StringSequence();

            seq.Add(item);
            Assert.Equal(expected: item, actual: seq[0]);
        }
コード例 #10
0
ファイル: FileReceiveSession.cs プロジェクト: zjbsean/TM
        public void OnListDirectorys(string name)
        {
            StringSequence strings = new StringSequence();

            if (Directory.Exists(BaseDir + _currentDirectory))
            {
                try
                {
                    string[] dirs = Directory.GetDirectories(BaseDir + _currentDirectory + "/" + name);
                    LogService.Info(this, "List folders under {0} success", name);

                    for (int i = 0; i < dirs.Length; i++)
                    {
                        strings.GetElements().AddRange(dirs);
                    }

                    _connection.Send(FileServerHelper.ListDirectorysResult(0, strings));
                    return;
                }
                catch (Exception err)
                {
                    LogService.ErrorE(this, string.Format("failed to list directory {0} under {1}", name, _currentDirectory), err);

                    strings.Add(err.Message);
                    _connection.Send(FileServerHelper.ListDirectorysResult(-1, strings));
                }
            }
            else
            {
                LogService.Warn(this, "Directory {0} does not exist", name);
                _connection.Send(FileServerHelper.ListDirectorysResult(-2, strings));
            }
        }
コード例 #11
0
        public void RemoveShouldRemove()
        {
            //arrange
            var seq = new StringSequence();

            seq.Add("");
            seq.Add("abc");
            seq.Add("1234");


            //act
            seq.Remove("abc");

            //assert
            Assert.Equal("", actual: seq[0]);
            Assert.Equal("1234", actual: seq[1]);
        }
コード例 #12
0
        public void CheckTextToEmogee(string item)
        {
            //arrange
            var seq = new StringSequence();

            //act
            seq.Add(item);

            //assert
            Assert.Equal("😁", item);
        }
コード例 #13
0
        public void AddShouldAdd(string item)
        {
            // arrange (any setup necessary to prepare for the behavior to test)
            var seq = new StringSequence();

            // act (do the thing you want to test)
            seq.Add(item);

            // assert (verify that the behavior was as expected)
            Assert.Equal(expected: item, actual: seq[0]);
        }
コード例 #14
0
        public void AddShouldAdd()
        {
            // arrange - any setup necessary to prepare for the behavior to test
            var seq = new StringSequence();

            // act - do the thing you want to test
            seq.Add("abc");

            // assert - verify that the behavior was as expected
            Assert.Equal(expected: "abc", actual: seq[0]);
        }