Guest User

Untitled

a guest
Jun 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. using Moq;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using System.Threading.Tasks;
  4. using System.Diagnostics.CodeAnalysis;
  5.  
  6. namespace LibraryTest
  7. {
  8. [TestClass]
  9. public class ApplicationTest
  10. {
  11. [TestMethod]
  12. public async Task GetDataFromDataBase_Returns_True()
  13. {
  14.  
  15. IApplication classUnderTest = new Application();
  16. var result = await classUnderTest.GetDataFromDataBase();
  17. Assert.IsTrue(result);
  18. }
  19. }
  20. }
  21.  
  22. ///////// Actual Class library
  23. using System;
  24.  
  25. namespace Library
  26. {
  27. public class Application : IApplication
  28. {
  29. public virtual async Task<bool> GetDataFromDataBase()
  30. {
  31. //if data retrive successfull, return true, else false
  32. return true;
  33. }
  34. }
  35. public interface IApplication
  36. {
  37. Task<bool> GetDataFromDataBase();
  38. }
  39. }
Add Comment
Please, Sign In to add comment