Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.44 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Collections.Generic;
  4. using System.Data.Objects;
  5. using System.Linq;
  6. using NUnit.Framework;
  7. using Robotdatabase;
  8. using Moq;
  9.  
  10. namespace UnitTest
  11. {
  12.     [TestFixture]
  13.     public class UnitTest
  14.     {
  15.         private ContextEntities objectContext = new ContextEntities();
  16.         private User u1, u2, u3, u4;
  17.         private Command c1, c2, c3;
  18.         private Task t1, t2, t3;
  19.         private Position p1, p2, p3, p4, p5;
  20.         private Log l1, l2, l3;
  21.         private LogLevel ll1, ll2, ll3;
  22.         private MeasuredItem mi1, mi2, mi3;
  23.         private ItemClassification ic1, ic2, ic3;
  24.  
  25.         [TestFixtureSetUp]
  26.         public void OneTimeSetup()
  27.         {
  28.             // This method is run only once, before any of the
  29.             // test cases
  30.             System.Console.WriteLine("Starting test suite ...");
  31.         }
  32.  
  33.         [SetUp]
  34.         public void RunBeforeEachTestCase()
  35.         {
  36.             // This method will be run before each test case
  37.             var userRepository = new UserRepository(objectContext);
  38.             //userRepository.DeleteAll();
  39.             u1 = new User();
  40.             u1.IsActive = "1";
  41.             u1.Password = "1234";
  42.             u1.RealName = "Mikkel";
  43.             u1.UserLevel = "Goblin";
  44.             u1.UserName = "Gremlin";
  45.  
  46.             u2 = new User();
  47.             u2.IsActive = "1";
  48.             u2.Password = "1234";
  49.             u2.RealName = "Hans ";
  50.             u2.UserLevel = "Minion";
  51.             u2.UserName = "Rogue Assassin";
  52.  
  53.             u3 = new User();
  54.             u3.IsActive = "1";
  55.             u3.Password = "1234";
  56.             u3.RealName = "Bent";
  57.             u3.UserLevel = "General";
  58.             u3.UserName = "Crazy Son Of A Bitch";
  59.  
  60.             c1 = new Command();
  61.             c1.Pitch = 23;
  62.             c1.Roll = 19;
  63.             c1.Position.X = 7;
  64.             c1.Position.Y = 90;
  65.             c1.Position.Z = 25;
  66.             c1.Task.TaskName = "Grab item";
  67.            
  68.         }
  69.  
  70.         [Test]
  71.         public void UserAdd()
  72.         {
  73.             UserRepository userRepository = new UserRepository(objectContext);
  74.             userRepository.Add(u1);
  75.             userRepository.Add(u2);
  76.             userRepository.Add(u3);
  77.             userRepository.Save();
  78.             User u = userRepository.GetUserByUserNameAndPassword("Rogue Assassin", "1234");
  79.             Assert.AreEqual(u, u1);
  80.         }
  81.  
  82.  
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement