Example #1
0
 public CreateUserModel(ITCApi api)
 {
     _api       = api;
     _userTypes = new Dictionary <string, int> {
         { "Administrator", 2 }, { "Montør", 1 }, { "Randers Kommune", 0 }
     };
 }
Example #2
0
 private ModelFactory()
 {
     _tcApi               = new TCApi();
     _logInModel          = new LogInModel(_tcApi);
     _homeModel           = new HomeModel(_tcApi);
     _userPreference      = new UserPreference(_tcApi);
     _settingsModel       = new SettingsModel();
     _createUserModel     = new CreateUserModel(_tcApi);
     _createCaseModel     = new CreateCaseModel(_tcApi);
     _caseModel           = new CaseModel(_tcApi);
     _changePasswordModel = new ChangePasswordModel(_tcApi);
     _mapModel            = new MapModel(_tcApi);
     _trafficLightModel   = new TrafficLightOverviewModel(_tcApi);
 }
        public void Init()
        {
            _fakeApi = Substitute.For <ITCApi>();


            _installations = new List <Installation>
            {
                new Installation()
                {
                    Id       = 1,
                    Name     = "First",
                    Position = new Position()
                    {
                        Id         = 1,
                        Latitude   = 10.1,
                        Longtitude = 50.2
                    },
                    Status = 0
                },
                new Installation()
                {
                    Id       = 2,
                    Name     = "Second",
                    Position = new Position()
                    {
                        Id         = 2,
                        Latitude   = 20.1,
                        Longtitude = 60.2
                    },
                    Status = 1
                },
                new Installation()
                {
                    Id       = 3,
                    Name     = "Third",
                    Position = new Position()
                    {
                        Id         = 3,
                        Latitude   = 30.1,
                        Longtitude = 70.2
                    },
                    Status = 2
                }
            };
            _fakeApi.GetInstallations().Returns(_installations);

            _uut = new CreateCaseModel(_fakeApi);
        }
        public void Init()
        {
            _fakeApi = Substitute.For <ITCApi>();
            _uut     = new UserPreference(_fakeApi);

            _fakeApi.UpdateUser(Arg.Any <User>()).Returns(true);
            _fakeApi.GetUser().Returns(new User()
            {
                Email             = "email",
                EmailNotification = true,
                SMSNotification   = true,
                FirstName         = "First",
                LastName          = "Last",
                Id     = "1",
                Number = "12341234",
                Role   = 0
            });
        }
Example #5
0
 public void Init()
 {
     _fakeApi = Substitute.For <ITCApi>();
     _uut     = new CaseModel(_fakeApi);
 }
Example #6
0
 public UserPreference(ITCApi api)
 {
     _api = api;
 }
Example #7
0
 public CaseModel(ITCApi api)
 {
     _api = api;
 }
Example #8
0
 public void Init()
 {
     _fakeApi = Substitute.For <ITCApi>();
     _uut     = new ChangePasswordModel(_fakeApi);
 }
Example #9
0
 public void Init()
 {
     _fakeTCApi = Substitute.For <ITCApi>();
     _uut       = new LogInModel(_fakeTCApi);
 }
Example #10
0
 public HomeModel(ITCApi api) : base()
 {
     _api     = api;
     _cases   = new List <Case>();
     _myCases = new List <Case>();
 }
Example #11
0
 public LogInModel(ITCApi tcApi)
 {
     _tcApi = tcApi;
 }
Example #12
0
 public MapModel(ITCApi api)
 {
     _api = api;
 }
 public TrafficLightOverviewModel(ITCApi api) : base()
 {
     _api           = api;
     _trafficLights = new List <Installation>();
     ThreadPool.QueueUserWorkItem(o => SlowMethod());
 }
Example #14
0
        public void Init()
        {
            _fakeApi = Substitute.For <ITCApi>();
            _uut     = new HomeModel(_fakeApi);

            _fakeApi.GetCases().Returns(new List <Case>());
            _fakeApi.GetCases().Add(new Case()
            {
                Id               = 1,
                Status           = CaseStatus.Done,
                ErrorDescription = "String3",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street3",
                }
            });
            _fakeApi.GetCases().Add(new Case()
            {
                Id               = 2,
                Status           = CaseStatus.Started,
                ErrorDescription = "String4",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
            _fakeApi.GetCases().Add(new Case()
            {
                Id               = 3,
                Status           = CaseStatus.Pending,
                ErrorDescription = "String4",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
            _fakeApi.GetCases().Add(new Case()
            {
                Id               = 4,
                Status           = CaseStatus.Created,
                ErrorDescription = "String4",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
            _fakeApi.GetCases().Add(new Case()
            {
                Id               = 5,
                Status           = CaseStatus.Created,
                ErrorDescription = "String4",
                Time             = new DateTime(2001),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });

            _fakeApi.GetMyCases().Returns(new List <Case>());
            _fakeApi.GetMyCases().Add(new Case()
            {
                Id               = 1,
                Status           = CaseStatus.Done,
                ErrorDescription = "String3",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street3",
                }
            });
            _fakeApi.GetMyCases().Add(new Case()
            {
                Id               = 2,
                Status           = CaseStatus.Started,
                ErrorDescription = "String4",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
            _fakeApi.GetMyCases().Add(new Case()
            {
                Id               = 3,
                Status           = CaseStatus.Pending,
                ErrorDescription = "String4",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
            _fakeApi.GetMyCases().Add(new Case()
            {
                Id               = 4,
                Status           = CaseStatus.Created,
                ErrorDescription = "String4",
                Time             = new DateTime(2000),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
            _fakeApi.GetMyCases().Add(new Case()
            {
                Id               = 5,
                Status           = CaseStatus.Created,
                ErrorDescription = "String4",
                Time             = new DateTime(2001),
                Installation     = new Installation()
                {
                    Id   = 1,
                    Name = "Street4",
                }
            });
        }
Example #15
0
 public ChangePasswordModel(ITCApi tcApi)
 {
     _tcApi = tcApi;
 }