Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. using Academy.Models;
  6.  
  7. namespace Academy.Tests.CourseTests
  8. {
  9.     [TestClass]
  10.     public class Name_Tests
  11.     {
  12.         DateTime? start = new DateTime(2019, 02, 18);
  13.         DateTime? end = new DateTime(2019, 02, 28);
  14.        
  15.         [TestMethod]
  16.         public void ThrowWhenNameIsNull()
  17.         {
  18.             // Arrange, Act, Assert
  19.             Assert.ThrowsException<ArgumentException>(() => new Course(null, 5, start, end));
  20.         }
  21.  
  22.         [TestMethod]
  23.         public void ThrowWhenNameIsSmallerThanMinValue()
  24.         {
  25.             // Arrange, Act, Assert
  26.             Assert.ThrowsException<ArgumentException>(() => new Course("aa", 5, start, end));
  27.         }
  28.  
  29.         [TestMethod]
  30.         public void ThrowWhenNameIsLargerThanMaxValue()
  31.         {
  32.             // Arrange, Act, Assert
  33.             Assert.ThrowsException<ArgumentException>(() => new Course(new string('a', 46), 5, start, end));
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement