Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Moq;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System.Threading.Tasks;
- using System.Diagnostics.CodeAnalysis;
- namespace LibraryTest
- {
- [TestClass]
- public class ApplicationTest
- {
- [TestMethod]
- public async Task GetDataFromDataBase_Returns_True()
- {
- IApplication classUnderTest = new Application();
- var result = await classUnderTest.GetDataFromDataBase();
- Assert.IsTrue(result);
- }
- }
- }
- ///////// Actual Class library
- using System;
- namespace Library
- {
- public class Application : IApplication
- {
- public virtual async Task<bool> GetDataFromDataBase()
- {
- //if data retrive successfull, return true, else false
- return true;
- }
- }
- public interface IApplication
- {
- Task<bool> GetDataFromDataBase();
- }
- }
Add Comment
Please, Sign In to add comment