コード例 #1
0
        public void UpdateFileContentBadExceptionLength(string fileid, string content, string id)
        {
            Mock <FileContent> fileContentDouble2 = new Mock <FileContent>();

            fileContentDouble2.Setup(fileContent => fileContent.FileId).Returns(fileid);
            fileContentDouble2.Setup(fileContent => fileContent.Content).Returns(content);
            fileContentDouble2.Setup(fileContent => fileContent.Id).Returns(id);

            fileContent = fileContentDouble2.Object;

            IDBManager fakeDatabase = new FakeDBManager();

            Assert.Throws <ArgumentException>(() =>
            {
                fakeDatabase.UpdateFileContent(fileContent);
            }
                                              );
        }
コード例 #2
0
        public void UpdateFileContentGood(string fileid, string content, string id)
        {
            Mock <FileContent> fileContentDouble2 = new Mock <FileContent>();

            fileContentDouble2.Setup(fileContent2 => fileContent2.FileId).Returns(fileid);
            fileContentDouble2.Setup(fileContent2 => fileContent2.Content).Returns(content);
            fileContentDouble2.Setup(fileContent2 => fileContent2.Id).Returns(id);

            fileContent2 = fileContentDouble2.Object;

            FakeDBManager fakeDatabase = new FakeDBManager();

            fakeDatabase.AddFileContent(fileContent);

            fakeDatabase.UpdateFileContent(fileContent2);

            Assert.AreEqual(fakeDatabase.GetContent(fileid), fileContent2.Content);
        }