コード例 #1
0
        public void GetContentGood(string id)
        {
            IDBManager fakeDatabase = new FakeDBManager();

            fakeDatabase.AddFileContent(fileContent);
            Assert.AreEqual(fileContent.Content, fakeDatabase.GetContent(id));
        }
コード例 #2
0
        public void GetContentBadNull(string id)
        {
            IDBManager fakeDatabase = new FakeDBManager();

            Assert.Throws <ArgumentNullException>(() =>
            {
                fakeDatabase.GetContent(id);
            }
                                                  );
        }
コード例 #3
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);
        }
コード例 #4
0
        public void GetContentIdDoesntExist(string id)
        {
            FakeDBManager fakeDatabase = new FakeDBManager();

            Assert.AreEqual("INVALID", fakeDatabase.GetContent(id));
        }