Пример #1
0
        public virtual void TestReadFields()
        {
            long           length         = 11111;
            long           fileCount      = 22222;
            long           directoryCount = 33333;
            long           quota          = 44444;
            long           spaceConsumed  = 55555;
            long           spaceQuota     = 66666;
            ContentSummary contentSummary = new ContentSummary.Builder().Build();
            BinaryReader   reader         = Org.Mockito.Mockito.Mock <BinaryReader>();

            Org.Mockito.Mockito.When(@in.ReadLong()).ThenReturn(length).ThenReturn(fileCount)
            .ThenReturn(directoryCount).ThenReturn(quota).ThenReturn(spaceConsumed).ThenReturn
                (spaceQuota);
            contentSummary.ReadFields(@in);
            Assert.Equal("getLength", length, contentSummary.GetLength());
            Assert.Equal("getFileCount", fileCount, contentSummary.GetFileCount
                             ());
            Assert.Equal("getDirectoryCount", directoryCount, contentSummary
                         .GetDirectoryCount());
            Assert.Equal("getQuota", quota, contentSummary.GetQuota());
            Assert.Equal("getSpaceConsumed", spaceConsumed, contentSummary
                         .GetSpaceConsumed());
            Assert.Equal("getSpaceQuota", spaceQuota, contentSummary.GetSpaceQuota
                             ());
        }
Пример #2
0
        public virtual void TestConstructorEmpty()
        {
            ContentSummary contentSummary = new ContentSummary.Builder().Build();

            Assert.Equal("getLength", 0, contentSummary.GetLength());
            Assert.Equal("getFileCount", 0, contentSummary.GetFileCount());
            Assert.Equal("getDirectoryCount", 0, contentSummary.GetDirectoryCount
                             ());
            Assert.Equal("getQuota", -1, contentSummary.GetQuota());
            Assert.Equal("getSpaceConsumed", 0, contentSummary.GetSpaceConsumed
                             ());
            Assert.Equal("getSpaceQuota", -1, contentSummary.GetSpaceQuota
                             ());
        }
Пример #3
0
        public virtual void TestConstructorNoQuota()
        {
            long           length         = 11111;
            long           fileCount      = 22222;
            long           directoryCount = 33333;
            ContentSummary contentSummary = new ContentSummary.Builder().Length(length).FileCount
                                                (fileCount).DirectoryCount(directoryCount).SpaceConsumed(length).Build();

            Assert.Equal("getLength", length, contentSummary.GetLength());
            Assert.Equal("getFileCount", fileCount, contentSummary.GetFileCount
                             ());
            Assert.Equal("getDirectoryCount", directoryCount, contentSummary
                         .GetDirectoryCount());
            Assert.Equal("getQuota", -1, contentSummary.GetQuota());
            Assert.Equal("getSpaceConsumed", length, contentSummary.GetSpaceConsumed
                             ());
            Assert.Equal("getSpaceQuota", -1, contentSummary.GetSpaceQuota
                             ());
        }
Пример #4
0
        public virtual void TestConstructorWithQuota()
        {
            long           length         = 11111;
            long           fileCount      = 22222;
            long           directoryCount = 33333;
            long           quota          = 44444;
            long           spaceConsumed  = 55555;
            long           spaceQuota     = 66666;
            ContentSummary contentSummary = new ContentSummary.Builder().Length(length).FileCount
                                                (fileCount).DirectoryCount(directoryCount).Quota(quota).SpaceConsumed(spaceConsumed
                                                                                                                      ).SpaceQuota(spaceQuota).Build();

            Assert.Equal("getLength", length, contentSummary.GetLength());
            Assert.Equal("getFileCount", fileCount, contentSummary.GetFileCount
                             ());
            Assert.Equal("getDirectoryCount", directoryCount, contentSummary
                         .GetDirectoryCount());
            Assert.Equal("getQuota", quota, contentSummary.GetQuota());
            Assert.Equal("getSpaceConsumed", spaceConsumed, contentSummary
                         .GetSpaceConsumed());
            Assert.Equal("getSpaceQuota", spaceQuota, contentSummary.GetSpaceQuota
                             ());
        }