Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Collections.Generic;
- using System.Data.Objects;
- using System.Linq;
- using NUnit.Framework;
- using Robotdatabase;
- using Moq;
- namespace UnitTest
- {
- [TestFixture]
- public class UnitTest
- {
- private ContextEntities objectContext = new ContextEntities();
- private User u1, u2, u3, u4;
- private Command c1, c2, c3;
- private Task t1, t2, t3;
- private Position p1, p2, p3, p4, p5;
- private Log l1, l2, l3;
- private LogLevel ll1, ll2, ll3;
- private MeasuredItem mi1, mi2, mi3;
- private ItemClassification ic1, ic2, ic3;
- [TestFixtureSetUp]
- public void OneTimeSetup()
- {
- // This method is run only once, before any of the
- // test cases
- System.Console.WriteLine("Starting test suite ...");
- }
- [SetUp]
- public void RunBeforeEachTestCase()
- {
- // This method will be run before each test case
- var userRepository = new UserRepository(objectContext);
- //userRepository.DeleteAll();
- u1 = new User();
- u1.IsActive = "1";
- u1.Password = "1234";
- u1.RealName = "Mikkel";
- u1.UserLevel = "Goblin";
- u1.UserName = "Gremlin";
- u2 = new User();
- u2.IsActive = "1";
- u2.Password = "1234";
- u2.RealName = "Hans ";
- u2.UserLevel = "Minion";
- u2.UserName = "Rogue Assassin";
- u3 = new User();
- u3.IsActive = "1";
- u3.Password = "1234";
- u3.RealName = "Bent";
- u3.UserLevel = "General";
- u3.UserName = "Crazy Son Of A Bitch";
- c1 = new Command();
- c1.Pitch = 23;
- c1.Roll = 19;
- c1.Position.X = 7;
- c1.Position.Y = 90;
- c1.Position.Z = 25;
- c1.Task.TaskName = "Grab item";
- }
- [Test]
- public void UserAdd()
- {
- UserRepository userRepository = new UserRepository(objectContext);
- userRepository.Add(u1);
- userRepository.Add(u2);
- userRepository.Add(u3);
- userRepository.Save();
- User u = userRepository.GetUserByUserNameAndPassword("Rogue Assassin", "1234");
- Assert.AreEqual(u, u1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement